module Doorkeeper::Orm::ActiveRecord::Mixins::AccessToken::ClassMethods

def active_for(resource_owner)

Returns:
  • (ActiveRecord::Relation) -

Parameters:
  • resource_owner (ActiveRecord::Base) --
def active_for(resource_owner)
  by_resource_owner(resource_owner).where(revoked_at: nil)
end

def compute_doorkeeper_table_name

def compute_doorkeeper_table_name
  table_name = "oauth_access_token"
  table_name = table_name.pluralize if pluralize_table_names
  "#{table_name_prefix}#{table_name}#{table_name_suffix}"
end

def not_expired

Returns non-expired and non-revoked access tokens
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

def refresh_token_revoked_on_use?

def refresh_token_revoked_on_use?
  column_names.include?("previous_refresh_token")
end