Module: Doorkeeper::Orm::ActiveRecord::Mixins::AccessToken::ClassMethods
- Defined in:
- lib/doorkeeper/orm/active_record/mixins/access_token.rb
Instance Method Summary collapse
-
#active_for(resource_owner) ⇒ ActiveRecord::Relation
Searches for not revoked Access Tokens associated with the specific Resource Owner.
-
#not_expired ⇒ Object
Returns non-expired and non-revoked access tokens.
- #refresh_token_revoked_on_use? ⇒ Boolean
Instance Method Details
#active_for(resource_owner) ⇒ ActiveRecord::Relation
Searches for not revoked Access Tokens associated with the specific Resource Owner.
39 40 41 |
# File 'lib/doorkeeper/orm/active_record/mixins/access_token.rb', line 39 def active_for(resource_owner) by_resource_owner(resource_owner).where(revoked_at: nil) end |
#not_expired ⇒ Object
Returns non-expired and non-revoked access tokens
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/doorkeeper/orm/active_record/mixins/access_token.rb', line 48 def not_expired relation = where(revoked_at: nil) if supports_expiration_time_math? # have not reached the expiration time or it never expires relation.where("#{expiration_time_sql} > ?", Time.now.utc).or( relation.where(expires_in: nil) ) else ::Kernel.warn <<~WARNING.squish [DOORKEEPER] Doorkeeper doesn't support expiration time math for your database adapter (#{adapter_name}). Please add a class method `custom_expiration_time_sql` for your AccessToken class/mixin to provide a custom SQL expression to calculate access token expiration time. See lib/doorkeeper/orm/active_record/mixins/access_token.rb for more details. WARNING relation end end |
#refresh_token_revoked_on_use? ⇒ Boolean
43 44 45 |
# File 'lib/doorkeeper/orm/active_record/mixins/access_token.rb', line 43 def refresh_token_revoked_on_use? column_names.include?("previous_refresh_token") end |