Module: Doorkeeper::AccessGrantMixin::ClassMethods
- Defined in:
- lib/doorkeeper/models/access_grant_mixin.rb
Instance Method Summary collapse
-
#by_token(token) ⇒ Doorkeeper::AccessGrant?
Searches for Doorkeeper::AccessGrant record with the specific token value.
-
#fallback_secret_strategy ⇒ Doorkeeper::SecretStoring::Base
Determine the fallback storing strategy Unless configured, there will be no fallback.
-
#generate_code_challenge(code_verifier) ⇒ #to_s
suitable for PKCE validation.
- #pkce_supported? ⇒ Boolean
-
#revoke_all_for(application_id, resource_owner, clock = Time) ⇒ Object
Revokes AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.
-
#secret_strategy ⇒ Doorkeeper::SecretStoring::Base
Determines the secret storing transformer Unless configured otherwise, uses the plain secret strategy.
Instance Method Details
#by_token(token) ⇒ Doorkeeper::AccessGrant?
Searches for Doorkeeper::AccessGrant record with the specific token value.
30 31 32 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 30 def by_token(token) find_by_plaintext_token(:token, token) end |
#fallback_secret_strategy ⇒ Doorkeeper::SecretStoring::Base
Determine the fallback storing strategy Unless configured, there will be no fallback
115 116 117 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 115 def fallback_secret_strategy ::Doorkeeper.config.token_secret_fallback_strategy end |
#generate_code_challenge(code_verifier) ⇒ #to_s
suitable for PKCE validation
91 92 93 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 91 def generate_code_challenge(code_verifier) Base64.urlsafe_encode64(Digest::SHA256.digest(code_verifier), padding: false) end |
#pkce_supported? ⇒ Boolean
95 96 97 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 95 def pkce_supported? column_names.include?("code_challenge") end |
#revoke_all_for(application_id, resource_owner, clock = Time) ⇒ Object
Revokes AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.
42 43 44 45 46 47 48 49 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 42 def revoke_all_for(application_id, resource_owner, clock = Time) by_resource_owner(resource_owner) .where( application_id: application_id, revoked_at: nil, ) .update_all(revoked_at: clock.now.utc) end |
#secret_strategy ⇒ Doorkeeper::SecretStoring::Base
Determines the secret storing transformer Unless configured otherwise, uses the plain secret strategy
105 106 107 |
# File 'lib/doorkeeper/models/access_grant_mixin.rb', line 105 def secret_strategy ::Doorkeeper.config.token_secret_strategy end |