Sha256: 87d6a27581ad659535424a9c45daf1f4139166be6f3942c1f3e5fb59de6ef147

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

# Authenticating 是身份鉴定,存储访问者(visitor)和信任状(credential)之间的关系。
# flag_code 有4个枚举值:RQRD (required)、SFCT (sufficient)、RQST (requisite)、OPTN (optional)。
# 各枚举值的含义见: http://docs.oracle.com/javase/8/docs/technotes/guides/security/jaas/JAASRefGuide.html 。

class Unidom::Visitor::Authenticating < ActiveRecord::Base

  self.table_name = 'unidom_authenticatings'

  belongs_to :visitor,    polymorphic: true
  belongs_to :credential, polymorphic: true

  scope :visitor_is,    ->(visitor)    { where visitor:    visitor    }
  scope :credential_is, ->(credential) { where credential: credential }

  include ::Unidom::Common::Concerns::ModelExtension

  def self.authenticate(visitor, credential)
    self.create! visitor: visitor, credential: credential, opened_at: Time.now
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-visitor-0.1 app/models/unidom/visitor/authenticating.rb