Module: MogueraAuthentication::Authable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rails/moguera_authentication/authable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #current_user ⇒ Object
- #current_user=(user) ⇒ Object
- #require_sign_in! ⇒ Object
- #sign_in!(user) ⇒ Object
- #sign_out! ⇒ Object
- #user_signed_in? ⇒ Boolean
Instance Method Details
#current_user ⇒ Object
13 14 15 |
# File 'lib/rails/moguera_authentication/authable.rb', line 13 def current_user @current_user end |
#current_user=(user) ⇒ Object
9 10 11 |
# File 'lib/rails/moguera_authentication/authable.rb', line 9 def current_user=(user) @current_user = user end |
#require_sign_in! ⇒ Object
21 22 23 24 |
# File 'lib/rails/moguera_authentication/authable.rb', line 21 def require_sign_in! validate_user! sign_in!(user_class.find_by(find_key => env['moguera.auth'].try(:access_key))) end |
#sign_in!(user) ⇒ Object
26 27 28 |
# File 'lib/rails/moguera_authentication/authable.rb', line 26 def sign_in!(user) self.current_user = user end |
#sign_out! ⇒ Object
30 31 32 |
# File 'lib/rails/moguera_authentication/authable.rb', line 30 def sign_out! self.current_user = nil end |
#user_signed_in? ⇒ Boolean
17 18 19 |
# File 'lib/rails/moguera_authentication/authable.rb', line 17 def user_signed_in? !!current_user end |