Class: SignIn::ClientConfig

Inherits:
ApplicationRecord show all
Includes:
SignIn::Concerns::Certifiable
Defined in:
app/models/sign_in/client_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SignIn::Concerns::Certifiable

#assertion_public_keys, #certificate_objects, #expired_certificates, #expiring_certificates, #load_certificate_objects, #self_signed_certificates

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Class Method Details

.valid_client_id?(client_id:) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/sign_in/client_config.rb', line 31

def self.valid_client_id?(client_id:)
  find_by(client_id:).present?
end

Instance Method Details

#api_auth?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/sign_in/client_config.rb', line 39

def api_auth?
  authentication == Constants::Auth::API
end

#appropriate_mock_environment?Boolean (private)

Returns:

  • (Boolean)


65
66
67
# File 'app/models/sign_in/client_config.rb', line 65

def appropriate_mock_environment?
  %w[test localhost development].include?(Settings.vsp_environment)
end

Returns:

  • (Boolean)


35
36
37
# File 'app/models/sign_in/client_config.rb', line 35

def cookie_auth?
  authentication == Constants::Auth::COOKIE
end

#device_sso_enabled?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'app/models/sign_in/client_config.rb', line 59

def device_sso_enabled?
  api_auth? && shared_sessions
end

#mock_auth?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/sign_in/client_config.rb', line 43

def mock_auth?
  authentication == Constants::Auth::MOCK && appropriate_mock_environment?
end

#va_terms_enforced?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/models/sign_in/client_config.rb', line 47

def va_terms_enforced?
  enforced_terms == Constants::Auth::VA_TERMS
end

#valid_credential_service_provider?(type) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/sign_in/client_config.rb', line 51

def valid_credential_service_provider?(type)
  credential_service_providers.include?(type)
end

#valid_service_level?(acr) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/sign_in/client_config.rb', line 55

def valid_service_level?(acr)
  service_levels.include?(acr)
end