#305 Authentication with Warden pro
Dec 05, 2011 | 12 minutes | Authentication, Rack
Warden makes it easy to move authentication up into Rack middleware. This means authentication can be accessed outside of a Rails controller such as in routes or in a mountable engine.
- Download:
- source code
- mp4
- m4v
- webm
- ogv
This is great, really great. When create an application with authentication, i used the
devise. But, after that i will try to integrate the warden. There is a very intresting
point that move our authentication up into Rack middleware. Great!
Every time our eyes keep on your screencasts.
Thank you Ryan,
Devise uses Warden under the hood.
Yeah, if you're using Devise, then you're already using Warden without knowing it.
Tnx. That was very useful. I'm currently rewriting the authentication of production app and both of today's episodes have been exactly what I needed.
Thanks!
It's just great!
By the way, I think there is a typo error on the Show Notes > Resources
Divise Warden Strategies (devise?)
Fantastic! This could very much come in handy for future projects.
Shouldn't "def warden" be a helper method? At least, we should hide it as action.
The warden method is private, so it's not accessible as an action. It only needs to be made a helper method if you intend on accessing it from your views.
Could this be used for a single sign-on system? So that I have an authentication app running that passes out authentications to different apps?
I think so, in fact this blog outlines ways of joining a Sinatra app with a Rails app basically using warden.
http://labnote.beedesk.com/sinatra-warden-rails-devise
Is anyone else having issues with playing videos on iPad?
These videos don't play well in Firefox on my souped up MBP 17". i have to use Safari or Chrome.
What version of Firefox? Mine is v9 and playing ok so far.
How would you apply a :remember_me strategy?
Any Ideas?
I know this might sound like asking why not use Devise? But how would you implement email sending and verification when a user signs up? Am working on it, but having some troubles with testing.
Warden + Cancan + namespaces anyone?
Source code isn`t available?
Sweet combination :)
It would be great to see how to test controllers using warden. I mean it would always be great to see more tests, but authentication systems all have their own implications when testing controllers.
Agreed Dan, I've been through hell trying to get controller tests with this stuff.
Great episode! Thank you, Ryan!
I wrote controller test helpers for Warden.
http://kentaroimai.com/articles/1-controller-test-helpers-for-warden
I want to use warden in my Sinatra app, but I am lost in one particular thing. How can I call specific route on Sinatra in failure_app lambda? I mean something like SessionsController.action(:new) but with Sinatra app. I know that I can use something like
but this solution don't send env variable, so env['warden'].message can't work.
Hi there!
I am trying to authenticate using warden for JSON based APIs(web services), I have defined my password strategy inside config/initializers as password_strategy.rb which has authenticate! method defined inside it. When I call this authenticate! method from sessions controller's create method, params inside authenticate! method are getting empty some how although I can see my params inside create method of sessions controller, not sure what magic is happening behind the scene.
Since my params are empty my authentication is detected as unauthorized and I am redirected to sessions new method for logging in again even my login credentials are correct.
Any help would be appreciated.
Thanks in advance.