-
Notifications
You must be signed in to change notification settings - Fork 204
Scopes
hassox edited this page Sep 13, 2010
·
11 revisions
Warden allows for multiple users to be logged in at the same time. This should be used very cautiously. Think, sudo access, or a publisher checking what viewing it as another user will look like, or a secured authentication step for checkout.
By default the scope is :default. The :default scope is used whenever no scope is stated.
A scope is identified by an object. (I would use a symbol usually)
env['warden'].authenticated?(:scope => :sudo)
env['warden'].authenticated?(:pgp, :scope => :sudo)
# The same options are available for #authenticate and #authenticate!
env['warden'].user(:sudo)
env['warden'].logout # Clear the session. Logs everyone out
env['warden'].logout(:default) # logout the :default user
env['warden'].logout(:admin) # logout the :admin user
You can keep each users data separate by using the Authenticated Session Data feature.