Class: OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- OmniauthCallbacksController
- Includes:
- AcceptsPendingInvitations, AuthHelper, AuthenticatesWithTwoFactorForAdminMode, Devise::Controllers::Rememberable, InitializesCurrentUserMode, KnownSignIn, Onboarding::Redirectable
- Defined in:
- app/controllers/omniauth_callbacks_controller.rb
Direct Known Subclasses
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
Instance Method Summary collapse
- #atlassian_oauth2 ⇒ Object
- #auth0 ⇒ Object
-
#failure ⇒ Object
Extend the standard implementation to also increment the number of failed sign in attempts.
-
#failure_message ⇒ Object
Extend the standard message generation to accept our custom exception.
- #handle_omniauth ⇒ Object
-
#openid_connect ⇒ Object
overridden in EE.
- #salesforce ⇒ Object
- #saml ⇒ Object
Methods included from AcceptsPendingInvitations
#accept_pending_invitations, #after_pending_invitations_hook
Methods included from CookiesHelper
Methods included from InitializesCurrentUserMode
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
Instance Method Details
#atlassian_oauth2 ⇒ Object
83 84 85 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 83 def atlassian_oauth2 omniauth_flow(Gitlab::Auth::Atlassian) end |
#auth0 ⇒ Object
67 68 69 70 71 72 73 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 67 def auth0 if oauth['uid'].blank? fail_auth0_login else handle_omniauth end end |
#failure ⇒ Object
Extend the standard implementation to also increment the number of failed sign in attempts
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 37 def failure update_login_counter_metric(failed_strategy.name, 'failed') if params[:username].present? && AuthHelper.form_based_provider?(failed_strategy.name) user = User.find_by_login(params[:username]) user&.increment_failed_attempts! log_failed_login(params[:username], failed_strategy.name) end super end |
#failure_message ⇒ Object
Extend the standard message generation to accept our custom exception
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 51 def exception = request.env["omniauth.error"] error = exception.error_reason if exception.respond_to?(:error_reason) error ||= exception.error if exception.respond_to?(:error) error ||= exception. if exception.respond_to?(:message) error ||= request.env["omniauth.error.type"].to_s error.to_s.humanize if error end |
#handle_omniauth ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 18 def handle_omniauth if ::AuthHelper.saml_providers.include?(oauth['provider'].to_sym) saml else omniauth_flow(Gitlab::Auth::OAuth) end end |
#openid_connect ⇒ Object
overridden in EE
31 32 33 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 31 def openid_connect handle_omniauth end |
#salesforce ⇒ Object
75 76 77 78 79 80 81 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 75 def salesforce if oauth.dig('extra', 'email_verified') handle_omniauth else fail_salesforce_login end end |
#saml ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 61 def saml omniauth_flow(Gitlab::Auth::Saml) rescue Gitlab::Auth::Saml::IdentityLinker::UnverifiedRequest redirect_unverified_saml_initiation end |