Module: Doorkeeper::ApplicationMixin
- Extended by:
- ActiveSupport::Concern
- Includes:
- Models::Concerns::WriteToPrimary, Models::Orderable, Models::Scopes, Models::SecretStorable, OAuth::Helpers
- Defined in:
- lib/doorkeeper/models/application_mixin.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#redirect_uri=(uris) ⇒ String
Set an application's valid redirect URIs.
-
#secret_matches?(input) ⇒ Boolean
Check whether the given plain text secret matches our stored secret.
Methods included from Models::Scopes
#includes_scope?, #scopes, #scopes=, #scopes_string
Instance Method Details
#redirect_uri=(uris) ⇒ String
Set an application's valid redirect URIs.
67 68 69 |
# File 'lib/doorkeeper/models/application_mixin.rb', line 67 def redirect_uri=(uris) super(uris.is_a?(Array) ? uris.join("\n") : uris) end |
#secret_matches?(input) ⇒ Boolean
Note:
When the secret matches only via the fallback strategy, the stored secret is upgraded to the active strategy as a side-effect (mirrors the find_by_plaintext_token -> find_by_fallback_token pattern).
Check whether the given plain text secret matches our stored secret
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/doorkeeper/models/application_mixin.rb', line 83 def secret_matches?(input) # return false if either is nil, since secure_compare depends on strings # but Application secrets MAY be nil depending on confidentiality. return false if input.nil? || secret.nil? input = input.to_s # When matching the secret by comparer function, all is well. return true if secret_strategy.secret_matches?(input, secret) # When fallback lookup is enabled, ensure applications with plain secrets # can still be found, upgrading the stored secret to the active strategy # on a successful match. if fallback_secret_strategy&.secret_matches?(input, secret) self.class.upgrade_fallback_value(self, :secret, input) true else false end end |