Module: Wallaby::AuthenticationConcern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/concerns/wallaby/authentication_concern.rb
Overview
Authentication related functions
Instance Method Summary collapse
-
#authenticate_wallaby_user! ⇒ true
This method will try to call #authenticate_user! from superclass.
-
#forbidden(exception = nil) ⇒ Object
Forbidden page.
-
#unauthorized(exception = nil) ⇒ Object
Unauthorized page.
-
#wallaby_user ⇒ Object
This method will try to call #current_user from superclass.
Instance Method Details
#authenticate_wallaby_user! ⇒ true
Note:
This is a template method that can be overridden by subclasses
This method will try to call #authenticate_user! from superclass. And it will be run as the first callback before an action.
45 46 47 48 49 50 |
# File 'lib/concerns/wallaby/authentication_concern.rb', line 45 def authenticate_wallaby_user! authenticated = try :authenticate_user! raise NotAuthenticated if authenticated == false true end |
#forbidden(exception = nil) ⇒ Object
Forbidden page.
60 61 62 |
# File 'lib/concerns/wallaby/authentication_concern.rb', line 60 def forbidden(exception = nil) render_error exception, __callee__ end |
#unauthorized(exception = nil) ⇒ Object
Unauthorized page.
54 55 56 |
# File 'lib/concerns/wallaby/authentication_concern.rb', line 54 def (exception = nil) render_error exception, __callee__ end |
#wallaby_user ⇒ Object
Note:
This is a template method that can be overridden by subclasses
This method will try to call #current_user from superclass.
30 31 32 |
# File 'lib/concerns/wallaby/authentication_concern.rb', line 30 def wallaby_user @wallaby_user ||= try :current_user end |