Class: OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- OmniauthCallbacksController
- Includes:
- AuthHelper, Authenticates2FAForAdminMode, AuthenticatesWithTwoFactor, Devise::Controllers::Rememberable, InitializesCurrentUserMode, KnownSignIn
- 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::PROVIDERS_WITH_ICONS
Instance Method Summary collapse
- #atlassian_oauth2 ⇒ Object
- #auth0 ⇒ Object
- #authentiq ⇒ Object
- #cas3 ⇒ 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
- #salesforce ⇒ Object
- #saml ⇒ Object
Methods included from CookiesHelper
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods included from InitializesCurrentUserMode
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
Instance Method Details
#atlassian_oauth2 ⇒ Object
86 87 88 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 86 def atlassian_oauth2 omniauth_flow(Gitlab::Auth::Atlassian) end |
#auth0 ⇒ Object
70 71 72 73 74 75 76 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 70 def auth0 if oauth['uid'].blank? fail_auth0_login else handle_omniauth end end |
#authentiq ⇒ Object
62 63 64 65 66 67 68 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 62 def authentiq if params['sid'] handle_service_ticket oauth['provider'], params['sid'] end handle_omniauth end |
#cas3 ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 53 def cas3 ticket = params['ticket'] if ticket handle_service_ticket oauth['provider'], ticket end handle_omniauth end |
#failure ⇒ Object
Extend the standard implementation to also increment the number of failed sign in attempts
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 25 def failure if params[:username].present? && AuthHelper.form_based_provider?(failed_strategy.name) user = User.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
37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 37 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
15 16 17 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 15 def handle_omniauth omniauth_flow(Gitlab::Auth::OAuth) end |
#salesforce ⇒ Object
78 79 80 81 82 83 84 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 78 def salesforce if oauth.dig('extra', 'email_verified') handle_omniauth else fail_salesforce_login end end |
#saml ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/omniauth_callbacks_controller.rb', line 47 def saml omniauth_flow(Gitlab::Auth::Saml) rescue Gitlab::Auth::Saml::IdentityLinker::UnverifiedRequest redirect_unverified_saml_initiation end |