Sha256: 4a3fe81535dde16c36a9e09266a5dd434f2103ba0865cfad2077b961c6687ee1
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
module DoorkeeperMongodb module Mixins module MongoMapper module AccessGrantMixin extend ActiveSupport::Concern include Doorkeeper::OAuth::Helpers include Doorkeeper::Models::Expirable include Doorkeeper::Models::Revocable include Doorkeeper::Models::Accessible include Doorkeeper::Models::Scopes included do belongs_to :application, class_name: 'Doorkeeper::Application' validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, presence: true validates :token, uniqueness: true before_validation :generate_token, on: :create end module ClassMethods # Searches for Doorkeeper::AccessGrant record with the # specific token value. # # @param token [#to_s] token value (any object that responds to `#to_s`) # # @return [Doorkeeper::AccessGrant, nil] AccessGrant object or nil # if there is no record with such token # def by_token(token) where(token: token.to_s).first end end private # Generates token value with UniqueToken class. # # @return [String] token value # def generate_token self.token = UniqueToken.generate end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-mongodb-4.0.1 | lib/doorkeeper-mongodb/mixins/mongo_mapper/access_grant_mixin.rb |
doorkeeper-mongodb-4.0.0 | lib/doorkeeper-mongodb/mixins/mongo_mapper/access_grant_mixin.rb |