module Doorkeeper::ApplicationMixin::ClassMethods

def by_uid(uid)

Returns:
  • (Doorkeeper::Application, nil) - Application instance or nil

Parameters:
  • uid (#to_s) -- UID (any object that responds to `#to_s`)
def by_uid(uid)
  find_by(uid: uid.to_s)
end

def by_uid_and_secret(uid, secret)

Returns:
  • (Doorkeeper::Application, nil) - Application instance or nil

Parameters:
  • secret (#to_s) -- secret (any object that responds to `#to_s`)
  • uid (#to_s) -- UID (any object that responds to `#to_s`)
def by_uid_and_secret(uid, secret)
  app = by_uid(uid)
  return unless app
  return app if secret.blank? && !app.confidential?
  return unless app.secret_matches?(secret)
  app
end

def perform_secret_hashing?

enables the configuration option +hash_application_secrets+
We want to perform secret hashing whenever the user
def perform_secret_hashing?
  Doorkeeper.configuration.hash_application_secrets?
end