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::POPULAR_PROVIDERS, 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, #failure, #failure_message, #handle_omniauth, #openid_connect, #salesforce, #saml

Methods included from AcceptsPendingInvitations

#accept_pending_invitations, #after_pending_invitations_hook

Methods included from CookiesHelper

#set_secure_cookie

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_app_owner_text, #auth_providers, #auth_strategy_class, #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?, #google_tag_manager_enabled?, #google_tag_manager_id, #icon_for_provider, #label_for_provider, #ldap_enabled?, #ldap_sign_in_enabled?, #link_provider_allowed?, #omniauth_enabled?, #popular_enabled_button_based_providers, #provider_has_builtin_icon?, #provider_has_custom_icon?, #provider_has_icon?, #provider_image_tag, #providers_for_base_controller, #qa_selector_for_provider, #saml_providers, #unlink_provider_allowed?

Methods included from AuthenticatesWithTwoFactorForAdminMode

#admin_mode_authenticate_with_two_factor, #admin_mode_authenticate_with_two_factor_via_otp, #admin_mode_authenticate_with_two_factor_via_webauthn, #admin_mode_prompt_for_two_factor

Class Method Details

.define_providers!Object



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

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

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

Instance Method Details

#fail_login(user) ⇒ Object



36
37
38
39
40
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 36

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.



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

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

  if Gitlab::CurrentSettings.admin_mode
    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



31
32
33
# File 'app/controllers/ldap/omniauth_callbacks_controller.rb', line 31

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