class Trestle::Auth::Backends::Warden
Public Instance Methods
authenticate()
click to toggle source
Authenticates the user using Warden
.
# File lib/trestle/auth/backends/warden.rb, line 11 def authenticate warden.authenticate(scope: scope) end
authenticate!()
click to toggle source
Authenticates a user from a login form request.
# File lib/trestle/auth/backends/warden.rb, line 6 def authenticate! authenticate end
logged_in?()
click to toggle source
Checks if there is a logged in user.
# File lib/trestle/auth/backends/warden.rb, line 16 def logged_in? warden.authenticated?(scope) end
login!(user)
click to toggle source
Stores the given user as logged in.
# File lib/trestle/auth/backends/warden.rb, line 26 def login!(user) warden.set_user(user, scope: scope) end
logout!()
click to toggle source
Logs out the current user.
# File lib/trestle/auth/backends/warden.rb, line 31 def logout! if scope warden.logout(scope) warden.clear_strategies_cache!(scope: scope) else warden.logout warden.clear_strategies_cache! end end
scope()
click to toggle source
Set the login params scope from configuration, which is also used as the Warden
scope.
# File lib/trestle/auth/backends/warden.rb, line 42 def scope Trestle.config.auth.warden.scope end
user()
click to toggle source
Returns the current logged in user.
# File lib/trestle/auth/backends/warden.rb, line 21 def user warden.user(scope) end
Protected Instance Methods
warden()
click to toggle source
# File lib/trestle/auth/backends/warden.rb, line 47 def warden request.env['warden'] end