Class: Wallaby::SecureController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Wallaby::SecureController
- Defined in:
- app/controllers/wallaby/secure_controller.rb
Overview
This controller only contains authentication logics
Direct Known Subclasses
Constant Summary
Constants inherited from ApplicationController
ApplicationController::ERROR_PATH
Instance Method Summary collapse
-
#current_user ⇒ Object
Precedence of current_user: - [Security] @see Wallaby::SecureController#security_config - super - do nothing.
-
#forbidden(exception = nil) ⇒ Object
Forbidden page.
-
#security_config ⇒ Wallaby::Configuration::Security
Security configuration.
-
#unauthorized(exception = nil) ⇒ Object
Unauthorized page.
Methods inherited from ApplicationController
#bad_request, #configuration, configuration, #healthy, #not_found, #unprocessable_entity
Instance Method Details
#current_user ⇒ Object
Precedence of current_user:
- Security
-
@see Wallaby::SecureController#security_config
-
super
-
do nothing
28 29 30 31 32 33 34 35 |
# File 'app/controllers/wallaby/secure_controller.rb', line 28 def current_user @current_user ||= if security_config.current_user? || !defined? super instance_exec(&security_config.current_user) else super end end |
#forbidden(exception = nil) ⇒ Object
Forbidden page
18 19 20 |
# File 'app/controllers/wallaby/secure_controller.rb', line 18 def forbidden(exception = nil) error_rendering(exception, __callee__) end |
#security_config ⇒ Wallaby::Configuration::Security
Returns security configuration.
38 39 40 |
# File 'app/controllers/wallaby/secure_controller.rb', line 38 def security_config configuration.security end |
#unauthorized(exception = nil) ⇒ Object
Unauthorized page
12 13 14 |
# File 'app/controllers/wallaby/secure_controller.rb', line 12 def (exception = nil) error_rendering(exception, __callee__) end |