Module: Doorkeeper::ApplicationMixin::ClassMethods

Defined in:
lib/doorkeeper/models/application_mixin.rb

Overview

:nodoc

Instance Method Summary collapse

Instance Method Details

#by_uid(uid) ⇒ Doorkeeper::Application?

Returns an instance of the Doorkeeper::Application with specific UID.

Parameters:

  • uid (#to_s)

    UID (any object that responds to ‘#to_s`)

Returns:



42
43
44
# File 'lib/doorkeeper/models/application_mixin.rb', line 42

def by_uid(uid)
  find_by(uid: uid.to_s)
end

#by_uid_and_secret(uid, secret) ⇒ Doorkeeper::Application?

Returns an instance of the Doorkeeper::Application with specific UID and secret.

Public/Non-confidential applications will only find by uid if secret is blank.

Parameters:

  • uid (#to_s)

    UID (any object that responds to ‘#to_s`)

  • secret (#to_s)

    secret (any object that responds to ‘#to_s`)

Returns:



26
27
28
29
30
31
32
33
# File 'lib/doorkeeper/models/application_mixin.rb', line 26

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

#fallback_secret_strategyObject

Determine the fallback storing strategy Unless configured, there will be no fallback



56
57
58
# File 'lib/doorkeeper/models/application_mixin.rb', line 56

def fallback_secret_strategy
  ::Doorkeeper.config.application_secret_fallback_strategy
end

#secret_strategyObject

Determines the secret storing transformer Unless configured otherwise, uses the plain secret strategy



49
50
51
# File 'lib/doorkeeper/models/application_mixin.rb', line 49

def secret_strategy
  ::Doorkeeper.config.application_secret_strategy
end