-
Notifications
You must be signed in to change notification settings - Fork 204
Users
Brooks Swinnerton edited this page Sep 16, 2015
·
3 revisions
Warden is all about authenticating requests. There’s two sides of that.
- The requester (user)
- The application
To access the user, simply call user on the auth object.
env['warden'].user # provides the currently logged in user
If you’re using a scoped authentication (scopes) you need to tell it which scoped user you would like:
env['warden'].user(:sudo)
The act of authentication will set the user when successful. Sometimes you may want to set the user manually.
env['warden'].set_user(@user)
Or if using scopes
env['warden'].set_user(@user, :scope => :admin)
You can also set store to false to set the user for that request, but do not store it in session
env['warden'].set_user(@user, :store => false)