class Warden::Proxy

def user(argument = {})

Experimental RBS support (using type sampling data from the type_fusion project).

def user: (?Hash argument) -> User

This signature was generated using 4 samples from 2 applications.

:api: public

env['warden'].user(:scope => :admin, :run_callbacks => true)
# with a scope and run_callbacks option

env['warden'].user(:run_callbacks => false)
# with default scope and run_callbacks option

env['warden'].user(:scope => :admin)
# as a Hash

env['warden'].user(:admin)
# with scope

env['warden'].user
# without scope (default user)
Example:

perform strategies.
Will be nil if not logged in. Please notice that this method does not
Provides access to the user object in a given scope for a request.
def user(argument = {})
  opts  = argument.is_a?(Hash) ? argument : { :scope => argument }
  scope = (opts[:scope] ||= @config.default_scope)
  if @users.has_key?(scope)
    @users[scope]
  else
    unless user = session_serializer.fetch(scope)
      run_callbacks = opts.fetch(:run_callbacks, true)
      manager._run_callbacks(:after_failed_fetch, user, self, :scope => scope) if run_callbacks
    end
    @users[scope] = user ? set_user(user, opts.merge(:event => :fetch)) : nil
  end
end