module DoorkeeperMongodb::Mixins::Mongoid::ApplicationMixin::ClassMethods

Public Instance Methods

by_uid(uid) click to toggle source

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

@param uid [#to_s] UID (any object that responds to `#to_s`)

@return [Doorkeeper::Application, nil] Application instance or nil

if there is no record with such UID
# File lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb, line 161
def by_uid(uid)
  where(uid: uid.to_s).first
end
by_uid_and_secret(uid, secret) click to toggle source

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.

@param uid [#to_s] UID (any object that responds to `#to_s`) @param secret [#to_s] secret (any object that responds to `#to_s`)

@return [Doorkeeper::Application, nil] Application instance or nil

if there is no record with such credentials
# File lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb, line 145
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_strategy() click to toggle source
# File lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb, line 169
def fallback_secret_strategy
  ::Doorkeeper.configuration.application_secret_fallback_strategy
end
revoke_tokens_and_grants_for(id, resource_owner) click to toggle source

Revokes AccessToken and AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.

@param resource_owner [ActiveRecord::Base]

instance of the Resource Owner model
# File lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb, line 179
def revoke_tokens_and_grants_for(id, resource_owner)
  Doorkeeper::AccessToken.revoke_all_for(id, resource_owner)
  Doorkeeper::AccessGrant.revoke_all_for(id, resource_owner)
end
secret_strategy() click to toggle source
# File lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb, line 165
def secret_strategy
  ::Doorkeeper.configuration.application_secret_strategy
end