module DoorkeeperMongodb::Mixins::Mongoid::AccessGrantMixin

Public Instance Methods

pkce_supported?() click to toggle source
# File lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb, line 50
def pkce_supported?
  respond_to? :code_challenge
end
plaintext_token() click to toggle source
# File lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb, line 54
def plaintext_token
  if secret_strategy.allows_restoring_secrets?
    secret_strategy.restore_secret(self, :token)
  else
    @raw_token
  end
end
uses_pkce?() click to toggle source

never uses pkce, if pkce migrations were not generated

# File lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb, line 46
def uses_pkce?
  pkce_supported? && code_challenge.present?
end

Private Instance Methods

generate_token() click to toggle source

Generates token value with UniqueToken class.

@return [String] token value

# File lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb, line 157
def generate_token
  return if self[:token].present?

  @raw_token = UniqueToken.generate
  secret_strategy.store_secret(self, :token, @raw_token)
end