Sha256: 09f7aa39c7d1789a400780f45ec365551bda634af9d4d461fa4a0155aaa8a2c0
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
module Rails::Authentication::SessionMixin # 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 class ActionController::Session::AbstractStore::SessionHash include Rails::Authentication::SessionMixin end class ActionController::TestSession < Hash include Rails::Authentication::SessionMixin end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
myobie-rails-auth-0.0.3 | lib/rails-auth/session_mixin.rb |
myobie-rails-auth-0.0.4 | lib/rails-auth/session_mixin.rb |