Sha256: b426cc5834ab47cfb32e186c125d6f0175c4e57877390098790a5977695ff689
Contents?: true
Size: 1.21 KB
Versions: 8
Compression:
Stored size: 1.21 KB
Contents
module Trestle module Auth module Backends class Warden < Base # Authenticates a user from a login form request. def authenticate! authenticate end # Authenticates the user using Warden. def authenticate warden.authenticate(scope: scope) end # Checks if there is a logged in user. def logged_in? warden.authenticated?(scope) end # Returns the current logged in user. def user warden.user(scope) end # Stores the given user as logged in. def login!(user) warden.set_user(user, scope: scope) end # Logs out the current user. def logout! if scope warden.logout(scope) warden.clear_strategies_cache!(scope: scope) else warden.logout warden.clear_strategies_cache! end end # Set the login params scope from configuration, which is also used as the Warden scope. def scope Trestle.config.auth.warden.scope end protected def warden request.env['warden'] end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems