Class: Devise::Strategies::PKCS12Authenticatable

Inherits:
DatabaseAuthenticatable
  • Object
show all
Defined in:
lib/devise_pkcs12_authenticatable/strategy.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!Object

rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Lint/AssignmentInCondition,Style/Semicolon,Metrics/LineLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/devise_pkcs12_authenticatable/strategy.rb', line 9

def authenticate!
  opts      = authentication_hash.merge(Hash[::Devise.pkcs12_common_name_field, common_name])
  resource  = password.present? && mapping.to.find_for_pkcs12_authentication(opts)
  encrypted = false

  if validate(resource) { encrypted = true; resource.valid_password?(password) } && resource.valid_common_name?(common_name)
    remember_me(resource)
    resource.after_database_authentication
    success!(resource)
  end

  mapping.to.new.password = password if !encrypted && Devise.paranoid

  fail!(:not_found_in_database) unless resource
end

#valid?Boolean

rubocop:enable Metrics/AbcSize,Metrics/CyclomaticComplexity,Lint/AssignmentInCondition,Style/Semicolon,Metrics/LineLength

Returns:

  • (Boolean)


26
27
28
# File 'lib/devise_pkcs12_authenticatable/strategy.rb', line 26

def valid?
  super && client_verify?
end