Module: Merb::Session

Defined in:
lib/merb-auth-core/session_mixin.rb

Instance Method Summary collapse

Instance Method Details

#abandon!Object

Remove the user from the session and clear all data.



40
41
42
# File 'lib/merb-auth-core/session_mixin.rb', line 40

def abandon!
  authentication.abandon!
end

#authenticate!(request, params, *rest) ⇒ Object

Authenticates the session via the authentication object.

See Merb::Authentication#authenticate for usage



24
25
26
# File 'lib/merb-auth-core/session_mixin.rb', line 24

def authenticate!(request, params, *rest)
  authentication.authenticate!(request, params, *rest)
end

#authenticated?Boolean

Check to see if the current session is authenticated

Returns:

  • (Boolean)

    true if authenticated. false otherwise



17
18
19
# File 'lib/merb-auth-core/session_mixin.rb', line 17

def authenticated?
  authentication.authenticated?
end

#authenticationObject

Access to the authentication object directly. Particularly useful for accessing the errors.

Example

<%= error_messages_for session.authentication %>


11
12
13
# File 'lib/merb-auth-core/session_mixin.rb', line 11

def authentication
  @authentication ||= Merb::Authentication.new(self)
end

#userObject

Provides access to the currently authenticated user.



29
30
31
# File 'lib/merb-auth-core/session_mixin.rb', line 29

def user
  authentication.user
end

#user=(the_user) ⇒ Object

set the currently authenticated user manually Merb::Authentication#store_user should know how to store the object into the session



35
36
37
# File 'lib/merb-auth-core/session_mixin.rb', line 35

def user=(the_user)
  authentication.user = the_user
end