Class: Doorkeeper::OAuth::Client
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::Client
- Defined in:
- lib/doorkeeper/oauth/client.rb
Constant Summary collapse
- Credentials =
Deprecated.
Moved to
Doorkeeper::ClientAuthentication::Credentials. This alias keeps the long-standingDoorkeeper::OAuth::Client::Credentialsconstant resolvable for one release so referencing code does not raiseNameError; update references to the new constant. Note the legacy +.from_request+/+.from_basic+/+.from_params+ class methods are gone — client credential extraction now goes through the client authentication registry (RFC 6749 §2.3). Marked withdeprecate_constant, so Ruby warns on access when deprecation warnings are enabled (+Warning = true+ or-W:deprecated). Doorkeeper::ClientAuthentication::Credentials
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
Class Method Summary collapse
- .authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) ⇒ Object
- .find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) ⇒ Object
Instance Method Summary collapse
-
#initialize(application) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(application) ⇒ Client
Returns a new instance of Client.
28 29 30 |
# File 'lib/doorkeeper/oauth/client.rb', line 28 def initialize(application) @application = application end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
24 25 26 |
# File 'lib/doorkeeper/oauth/client.rb', line 24 def application @application end |
Class Method Details
.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/doorkeeper/oauth/client.rb', line 38 def self.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret)) return if credentials.blank? # Credentials that were fully authenticated by their client # authentication method (e.g. a verified private_key_jwt assertion) # carry no secret to compare — resolve the client by uid alone. return find(credentials.uid) if credentials.respond_to?(:pre_authenticated?) && credentials.pre_authenticated? return unless (application = method.call(credentials.uid, credentials.secret)) new(application) end |
.find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) ⇒ Object
32 33 34 35 36 |
# File 'lib/doorkeeper/oauth/client.rb', line 32 def self.find(uid, method = Doorkeeper.config.application_model.method(:by_uid)) return unless (application = method.call(uid)) new(application) end |