Module: DoorkeeperMongodb::Mixins::Mongoid::ApplicationMixin::ClassMethods
- Defined in:
- lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb
Instance Method Summary collapse
-
#by_uid(uid) ⇒ Doorkeeper::Application?
Returns an instance of the Doorkeeper::Application with specific UID.
-
#by_uid_and_secret(uid, secret) ⇒ Doorkeeper::Application?
Returns an instance of the Doorkeeper::Application with specific UID and secret.
- #fallback_secret_strategy ⇒ Object
-
#revoke_tokens_and_grants_for(id, resource_owner) ⇒ Object
Revokes AccessToken and AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.
- #secret_strategy ⇒ Object
Instance Method Details
#by_uid(uid) ⇒ Doorkeeper::Application?
Returns an instance of the Doorkeeper::Application with specific UID.
161 162 163 |
# 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) ⇒ Doorkeeper::Application?
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.
145 146 147 148 149 150 151 152 |
# 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 ⇒ Object
169 170 171 |
# 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) ⇒ Object
Revokes AccessToken and AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.
179 180 181 182 |
# 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 ⇒ Object
165 166 167 |
# File 'lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb', line 165 def secret_strategy ::Doorkeeper.configuration.application_secret_strategy end |