Module: Tasker::Authentication::Interface
- Included in:
- NoneAuthenticator
- Defined in:
- lib/tasker/authentication/interface.rb
Overview
Interface that host application authenticators must implement
Instance Method Summary collapse
-
#authenticate!(controller) ⇒ void
Required: Authenticate the request, raise exception if fails.
-
#authenticated?(controller) ⇒ Boolean
Optional: Check if user is authenticated (uses current_user by default).
-
#current_user(controller) ⇒ Object?
Required: Get the current authenticated user.
-
#validate_configuration(_options = {}) ⇒ Array<String>
Optional: Configuration validation for the authenticator.
Instance Method Details
#authenticate!(controller) ⇒ void
This method returns an undefined value.
Required: Authenticate the request, raise exception if fails
10 11 12 |
# File 'lib/tasker/authentication/interface.rb', line 10 def authenticate!(controller) raise NotImplementedError, 'Authenticator must implement #authenticate!' end |
#authenticated?(controller) ⇒ Boolean
Optional: Check if user is authenticated (uses current_user by default)
24 25 26 |
# File 'lib/tasker/authentication/interface.rb', line 24 def authenticated?(controller) current_user(controller).present? end |
#current_user(controller) ⇒ Object?
Required: Get the current authenticated user
17 18 19 |
# File 'lib/tasker/authentication/interface.rb', line 17 def current_user(controller) raise NotImplementedError, 'Authenticator must implement #current_user' end |
#validate_configuration(_options = {}) ⇒ Array<String>
Optional: Configuration validation for the authenticator
31 32 33 |
# File 'lib/tasker/authentication/interface.rb', line 31 def validate_configuration( = {}) [] end |