Module: DoorkeeperMongodb::Mixins::Mongoid::AccessGrantMixin::ClassMethods
- Defined in:
- lib/doorkeeper-mongodb/mixins/mongoid/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 ⇒ Object
Determine the fallback storing strategy Unless configured, there will be no fallback.
-
#generate_code_challenge(code_verifier) ⇒ #to_s
An encoded code challenge based on the provided verifier suitable for PKCE validation.
-
#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 ⇒ Object
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.
72 73 74 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb', line 72 def by_token(token) find_by_plaintext_token(:token, token) end |
#fallback_secret_strategy ⇒ Object
Determine the fallback storing strategy Unless configured, there will be no fallback
146 147 148 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb', line 146 def fallback_secret_strategy ::Doorkeeper.config.token_secret_fallback_strategy end |
#generate_code_challenge(code_verifier) ⇒ #to_s
Returns An encoded code challenge based on the provided verifier suitable for PKCE validation.
129 130 131 132 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb', line 129 def generate_code_challenge(code_verifier) padded_result = Base64.urlsafe_encode64(Digest::SHA256.digest(code_verifier)) padded_result.split("=")[0] # Remove any trailing '=' 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.
84 85 86 87 88 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb', line 84 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 ⇒ Object
Determines the secret storing transformer Unless configured otherwise, uses the plain secret strategy
139 140 141 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/access_grant_mixin.rb', line 139 def secret_strategy ::Doorkeeper.config.token_secret_strategy end |