Sha256: 6e2561ce7e39e72d808e09ab2ca3d6d2edada0f7b2207761ba7d16b8de689179

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

class ActionController::Session::AbstractStore::SessionHash
  
  # Access to the authentication object directly.  Particularly useful
  # for accessing the errors.
  # 
  # === Example
  #
  #    <%= error_messages_for session.authentication %>
  # 
  def authentication
    @authentication ||= Rails::Authentication.new(self)
  end

  # Check to see if the current session is authenticated
  # @return true if authenticated.  false otherwise
  def authenticated?
    authentication.authenticated?
  end

  # Authenticates the session via the authentication object. 
  #
  # See Rails::Authentication#authenticate for usage
  def authenticate!(request, params, *rest)
    authentication.authenticate!(request, params, *rest)
  end

  # Provides access to the currently authenticated user.
  def user
    authentication.user
  end

  # set the currently authenticated user manually
  # Rails::Authentication#store_user should know how to store the object into the session
  def user=(the_user)
    authentication.user = the_user
  end

  # Remove the user from the session and clear all data.
  def abandon!
    authentication.abandon!
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
myobie-rails-auth-0.0.0 lib/rails-auth/session_mixin.rb
myobie-rails-auth-0.0.2 lib/rails-auth/session_mixin.rb