Class: Ldap::OmniauthCallbacksController

Inherits:
OmniauthCallbacksController show all
Extended by:
Gitlab::Utils::Override
Defined in:
app/controllers/ldap/omniauth_callbacks_controller.rb

Constant Summary

Constants included from KnownSignIn

KnownSignIn::KNOWN_SIGN_IN_COOKIE, KnownSignIn::KNOWN_SIGN_IN_COOKIE_EXPIRY

Constants included from CookiesHelper

CookiesHelper::COOKIE_TYPE_ENCRYPTED, CookiesHelper::COOKIE_TYPE_PERMANENT

Constants included from AuthHelper

AuthHelper::LDAP_PROVIDER, AuthHelper::PROVIDERS_WITH_ICONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

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

Methods inherited from OmniauthCallbacksController

#atlassian_oauth2, #auth0, #authentiq, #cas3, #failure, #failure_message, #handle_omniauth, #salesforce, #saml

Methods included from CookiesHelper

#set_secure_cookie

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from InitializesCurrentUserMode

#current_user_mode

Methods included from AuthHelper

#allow_admin_mode_password_authentication_for_web?, #any_form_based_providers_enabled?, #auth_active?, #auth_providers, #button_based_providers, #button_based_providers_enabled?, #crowd_enabled?, #display_providers_on_profile?, #enabled_button_based_providers, #form_based_auth_provider_has_active_class?, #form_based_provider?, #form_based_provider_priority, #form_based_provider_with_highest_priority, #form_based_providers, #form_enabled_for_sign_in?, #icon_for_provider, #label_for_provider, #ldap_enabled?, #ldap_sign_in_enabled?, #link_provider_allowed?, #omniauth_enabled?, #provider_has_builtin_icon?, #provider_has_custom_icon?, #provider_has_icon?, #provider_image_tag, #providers_for_base_controller, #qa_class_for_provider, #unlink_provider_allowed?

Methods included from Authenticates2FAForAdminMode

#admin_mode_authenticate_with_two_factor, #admin_mode_authenticate_with_two_factor_via_otp, #admin_mode_authenticate_with_two_factor_via_u2f, #admin_mode_authenticate_with_two_factor_via_webauthn, #admin_mode_prompt_for_two_factor

Methods included from AuthenticatesWithTwoFactor

#authenticate_with_two_factor, #handle_locked_user, #locked_user_redirect, #prompt_for_two_factor

Class Method Details

.define_providers!Object


6
7
8
9
10
11
12
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 6

def self.define_providers!
  return unless Gitlab::Auth::Ldap::Config.

  Gitlab::Auth::Ldap::Config.available_servers.each do |server|
    alias_method server['provider_name'], :ldap
  end
end

Instance Method Details

#fail_login(user) ⇒ Object


34
35
36
37
38
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 34

def (user)
  flash[:alert] = _('Access denied for your LDAP account.')

  redirect_to new_user_session_path
end

#ldapObject

We only find ourselves here if the authentication to LDAP was successful.


16
17
18
19
20
21
22
23
24
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 16

def ldap
  return unless Gitlab::Auth::Ldap::Config.

  if Feature.enabled?(:user_mode_in_session)
    return admin_mode_flow(Gitlab::Auth::Ldap::User) if current_user_mode.admin_mode_requested?
  end

  (Gitlab::Auth::Ldap::User)
end

#set_remember_me(user) ⇒ Object


29
30
31
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 29

def set_remember_me(user)
  user.remember_me = params[:remember_me] if user.persisted?
end