Class: Gitlab::Auth::Saml::User

Inherits:
OAuth::User show all
Extended by:
Utils::Override
Defined in:
lib/gitlab/auth/saml/user.rb

Constant Summary

Constants inherited from OAuth::User

OAuth::User::IdentityWithUntrustedExternUidError, OAuth::User::SigninDisabledForProviderError, OAuth::User::SignupDisabledError, OAuth::User::UnknownAttributeMappingError

Instance Attribute Summary

Attributes inherited from OAuth::User

#auth_hash

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods inherited from OAuth::User

#find_and_update!, find_by_uid_and_provider, #gl_user, #initialize, #new?, #persisted?, #save, #valid?, #valid_sign_in?

Constructor Details

This class inherits a constructor from Gitlab::Auth::OAuth::User

Instance Method Details

#bypass_two_factor?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/gitlab/auth/saml/user.rb', line 33

def bypass_two_factor?
  saml_config.upstream_two_factor_authn_contexts&.include?(auth_hash.authn_context)
end

#find_userObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/auth/saml/user.rb', line 14

def find_user
  user = find_by_uid_and_provider

  user ||= find_by_email if auto_link_saml_user?
  user ||= find_or_build_ldap_user if auto_link_ldap_user?
  user ||= build_new_user if 

  user&.external = external_user? if any_external_config_present?

  user
end

#protocol_nameObject



37
38
39
# File 'lib/gitlab/auth/saml/user.rb', line 37

def protocol_name
  'SAML'
end

#should_save?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/gitlab/auth/saml/user.rb', line 27

def should_save?
  return true unless gl_user

  gl_user.changed? || gl_user.identities.any?(&:changed?)
end