class Users::OmniauthCallbacksController
Handles the OpenID Connect sign-in callback from Devise. Finds or rejects the user from the omniauth payload and records SSO failures as error events. The openid_connect route skips CSRF verification because the IdP posts to it.
Public Instance Methods
Source
# File app/controllers/users/omniauth_callbacks_controller.rb, line 24 def failure record_sso_failure("omniauth-failure") redirect_to new_user_session_path, alert: t("auth.errors.sso_failed") end
Records a failed omniauth flow and redirects back to the sign-in screen.
Source
# File app/controllers/users/omniauth_callbacks_controller.rb, line 10 def openid_connect user = User.from_omniauth(request.env["omniauth.auth"]) if user&.persisted? sign_in_and_redirect user, event: :authentication set_flash_message!(:notice, :success, kind: AuthConfig.provider_label) else record_sso_failure("identity-not-found") redirect_to new_user_session_path, alert: t("auth.errors.sso_failed") end end
Completes SSO sign-in for a known user, or rejects unknown identities with an alert.