Module: PadlockAuth::Rails::ActionCableChannelHelpers
- Defined in:
- lib/padlock_auth/rails/action_cable_channel_helpers.rb
Defined Under Namespace
Modules: TokenFactory
Instance Method Summary collapse
-
#padlock_auth_token ⇒ PadlockAuth::AbstractToken?
Retrieve the access token from the request.
-
#padlock_authorized?(*scopes) ⇒ Boolean
Authorize the request with the given scopes.
Instance Method Details
#padlock_auth_token ⇒ PadlockAuth::AbstractToken?
Retrieve the access token from the request.
Does not check if the token is valid or matches the required scopes.
66 67 68 |
# File 'lib/padlock_auth/rails/action_cable_channel_helpers.rb', line 66 def padlock_auth_token @padlock_auth_token ||= TokenFactory.authenticate(params) end |
#padlock_authorized?(*scopes) ⇒ Boolean
Authorize the request with the given scopes.
If the request is not authorized, an error response will be rendered or an exception will be raised, depending on the configuration.
54 55 56 |
# File 'lib/padlock_auth/rails/action_cable_channel_helpers.rb', line 54 def (*scopes) padlock_auth_token&.acceptable?(scopes.presence || PadlockAuth.config.default_scopes) end |