Class: Doorkeeper::ClientAuthentication::LegacyCallable
- Inherits:
-
Object
- Object
- Doorkeeper::ClientAuthentication::LegacyCallable
- Defined in:
- lib/doorkeeper/client_authentication/legacy_callable.rb
Overview
Adapter that lets a legacy callable client_credentials extractor
(e.g. ->(request) { [client_id, client_secret] }) keep working through
the client authentication registry during the deprecation window.
The callable is expected to return a [uid, secret] pair (or nil when
it does not apply), matching the historical Credentials.from_request
contract. It is considered to match a request whenever it yields present
credentials, mirroring the previous "first extractor that returns a uid
wins" behaviour.
Instance Method Summary collapse
- #authenticate(request) ⇒ Object
-
#initialize(callable) ⇒ LegacyCallable
constructor
A new instance of LegacyCallable.
- #matches_request?(request) ⇒ Boolean
-
#uses_shared_secret? ⇒ Boolean
Legacy extractors pull a uid/secret pair out of the request, so they are treated as shared-secret methods.
Constructor Details
#initialize(callable) ⇒ LegacyCallable
Returns a new instance of LegacyCallable.
15 16 17 |
# File 'lib/doorkeeper/client_authentication/legacy_callable.rb', line 15 def initialize(callable) @callable = callable end |
Instance Method Details
#authenticate(request) ⇒ Object
29 30 31 |
# File 'lib/doorkeeper/client_authentication/legacy_callable.rb', line 29 def authenticate(request) credentials_for(request) end |
#matches_request?(request) ⇒ Boolean
25 26 27 |
# File 'lib/doorkeeper/client_authentication/legacy_callable.rb', line 25 def matches_request?(request) credentials_for(request).present? end |
#uses_shared_secret? ⇒ Boolean
Legacy extractors pull a uid/secret pair out of the request, so they are treated as shared-secret methods.
21 22 23 |
# File 'lib/doorkeeper/client_authentication/legacy_callable.rb', line 21 def uses_shared_secret? true end |