Sha256: a4af622462efb6826ae9975dfeccfafb482c9bd0ff2dd2fcb743e30a55d800b7
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
module Doorkeeper class AccessGrant < ActiveRecord::Base self.table_name = "#{table_name_prefix}oauth_access_grants#{table_name_suffix}".to_sym include AccessGrantMixin include ActiveModel::MassAssignmentSecurity if defined?(::ProtectedAttributes) belongs_to_options = { class_name: 'Doorkeeper::Application', inverse_of: :access_grants } if defined?(ActiveRecord::Base) && ActiveRecord::VERSION::MAJOR >= 5 belongs_to_options[:optional] = true end belongs_to :application, belongs_to_options validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, presence: true validates :token, uniqueness: true before_validation :generate_token, on: :create # Keep a reference to the generated token during generation # of this access grant. The actual token may be mapped by # the configuration hasher and may not be available in plaintext. # # If hash tokens are enabled, this will return nil on fetched tokens def plaintext_token if perform_secret_hashing? @raw_token else token end end private # Generates token value with UniqueToken class. # # @return [String] token value # def generate_token @raw_token = UniqueToken.generate self.token = hashed_or_plain_token(@raw_token) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-5.1.0.rc1 | lib/doorkeeper/orm/active_record/access_grant.rb |