module Doorkeeper::ApplicationMixin

Public Instance Methods

redirect_uri=(uris) click to toggle source

Set an application’s valid redirect URIs.

@param uris [String, Array<String>] Newline-separated string or array the URI(s)

@return [String] The redirect URI(s) separated by newlines.

Calls superclass method
# 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) click to toggle source

Check whether the given plain text secret matches our stored secret

@param input [#to_s] Plain secret provided by user

(any object that responds to `#to_s`)

@return [Boolean] Whether the given secret matches the stored secret

of this application.
# File lib/doorkeeper/models/application_mixin.rb, line 79
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?

  # 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
  if fallback_secret_strategy
    fallback_secret_strategy.secret_matches?(input, secret)
  else
    false
  end
end