Class: OauthAccessToken

Inherits:
Doorkeeper::AccessToken
  • Object
show all
Defined in:
app/models/oauth_access_token.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_fallback_token(attr, plain_secret) ⇒ Object

this method overrides a shortcoming upstream, more context: gitlab.com/gitlab-org/gitlab/-/issues/367888



24
25
26
27
28
29
30
# File 'app/models/oauth_access_token.rb', line 24

def self.find_by_fallback_token(attr, plain_secret)
  return unless fallback_secret_strategy && fallback_secret_strategy == Doorkeeper::SecretStoring::Plain
  # token is hashed, don't allow plaintext comparison
  return if plain_secret.starts_with?("$")

  super
end

.matching_token_for(application, resource_owner, scopes) ⇒ Object

Override Doorkeeper::AccessToken.matching_token_for since we have ‘reuse_access_tokens` disabled and we also hash tokens. This ensures we don’t accidentally return a hashed token value.



35
36
37
# File 'app/models/oauth_access_token.rb', line 35

def self.matching_token_for(application, resource_owner, scopes)
  # no-op
end

Instance Method Details

#scopes=(value) ⇒ Object



14
15
16
17
18
19
20
# File 'app/models/oauth_access_token.rb', line 14

def scopes=(value)
  if value.is_a?(Array)
    super(Doorkeeper::OAuth::Scopes.from_array(value).to_s)
  else
    super
  end
end