Class: Unidom::Visitor::Authenticating

Inherits:
ApplicationRecord show all
Includes:
ProgneTapera::EnumCode, Common::Concerns::ModelExtension
Defined in:
app/models/unidom/visitor/authenticating.rb

Overview

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

Class Method Summary collapse

Class Method Details

.authenticate!(visitor, with: nil, opened_at: Time.now) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'app/models/unidom/visitor/authenticating.rb', line 27

def self.authenticate!(visitor, with: nil, opened_at: Time.now)

  assert_present! :visitor,   visitor
  assert_present! :with,      with
  assert_present! :opened_at, opened_at

  credential_is(with).visitor_is(visitor).valid_at.alive.first_or_create! opened_at: opened_at

end