Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Warden is all about authenticating requests. There’s two sides of that.
- The requester (user)
- The application
Accessing a user
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:
Setting the User
The act of authentication will set the user when successful. Sometimes you may want to set the user manually.
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)