Module: Rails::Authentication::SessionMixin
- Defined in:
- lib/rails-auth/session_mixin.rb
Instance Method Summary collapse
-
#abandon! ⇒ Object
Remove the user from the session and clear all data.
-
#authenticate!(request, params, *rest) ⇒ Object
Authenticates the session via the authentication object.
-
#authenticated? ⇒ Boolean
Check to see if the current session is authenticated.
-
#authentication ⇒ Object
Access to the authentication object directly.
-
#user ⇒ Object
Provides access to the currently authenticated user.
-
#user=(the_user) ⇒ Object
set the currently authenticated user manually Rails::Authentication#store_user should know how to store the object into the session.
Instance Method Details
#abandon! ⇒ Object
Remove the user from the session and clear all data.
38 39 40 |
# File 'lib/rails-auth/session_mixin.rb', line 38 def abandon! authentication.abandon! end |
#authenticate!(request, params, *rest) ⇒ Object
Authenticates the session via the authentication object.
See Rails::Authentication#authenticate for usage
22 23 24 |
# File 'lib/rails-auth/session_mixin.rb', line 22 def authenticate!(request, params, *rest) authentication.authenticate!(request, params, *rest) end |
#authenticated? ⇒ Boolean
Check to see if the current session is authenticated
15 16 17 |
# File 'lib/rails-auth/session_mixin.rb', line 15 def authenticated? authentication.authenticated? end |
#authentication ⇒ Object
Access to the authentication object directly. Particularly useful for accessing the errors.
Example
<%= error_messages_for session.authentication %>
9 10 11 |
# File 'lib/rails-auth/session_mixin.rb', line 9 def authentication @authentication ||= Rails::Authentication.new(self) end |
#user ⇒ Object
Provides access to the currently authenticated user.
27 28 29 |
# File 'lib/rails-auth/session_mixin.rb', line 27 def user authentication.user end |
#user=(the_user) ⇒ Object
set the currently authenticated user manually Rails::Authentication#store_user should know how to store the object into the session
33 34 35 |
# File 'lib/rails-auth/session_mixin.rb', line 33 def user=(the_user) authentication.user = the_user end |