I know I’ve met a lot of you, but here is a bit of info about myself
Today I’d like to talk a bit about Warden.
So, I am going to talk about warden, but the goal of the talk is to understand just enough about warden so that Devise seems a little less magical.
Who here has used Devise?Who here has used Warden directly?
ON NEXT SLIDEWarden definition
AFTER THIS SLIDELets take a look at how warden fits into the rack application stack
First off, you are required to use some sort of session middleware upstream of warden. I’ve used Rack::Session for thisNext, warden is a piece of middleware that lazily places a warden proxy object into the rack environmentAll rack applications mounted after warden now have access to this warden object, allowing you to share authentication between any number of rack apps
That’s all well and good, but you have to ask, why should I learn more?
Now, before we go on, we need to define some terminology.You’ll have to forgive me for a bit of hand-waving, but hopefully it will become more clear after the demo
Of course, you’ll need to provide the logic for serializing and deserializing your object into and out of the session. We’ll get to that a bit later
Strategies typically define two methods: valid? : This normally just checks to see if the correct parameters are coming in, dismissing the request if they are wasting your time authenticate! : This method houses the logic for determining whether or not the parameters passed in pass or fail authenticationStrategies are cascading
This can be any mounted rack app. For example, a Rails controller or Sinatra application.
So you can assign which strategies to use for a specific scopeYou can define a default scopeWhen you call authenticate! You can specify which scope you’d like to authenticate against
I’ve only scrapped the surface of how Warden worksBut, much like sleeping inside of a tauntaun, Warden isn’t so bad after all…I’ll be at rusty bucket afterwards, I’ll do my best to answer any questions you might haveThanks!