Use single OIDC session auth method instead of per-provider values

The OIDC provider is already tracked in iam_oidc_states.provider, so
there is no need for provider-specific session auth methods (GOOGLE,
MICROSOFT). Replace them with a single OIDC auth method.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-23 08:31:10 +01:00
parent 7e757bfa06
commit 1d3cc1c65e
3 changed files with 4 additions and 14 deletions

View File

@@ -110,19 +110,11 @@ func (h *OIDCHandler) CallbackHandler(w http.ResponseWriter, r *http.Request) {
return
}
var authMethod coredata.AuthMethod
switch provider {
case coredata.OIDCProviderGoogle:
authMethod = coredata.AuthMethodGoogle
case coredata.OIDCProviderMicrosoft:
authMethod = coredata.AuthMethodMicrosoft
}
rootSession := authn.SessionFromContext(ctx)
switch {
case rootSession == nil:
rootSession, err = h.iam.AuthService.OpenSessionWithOIDC(ctx, identity.ID, authMethod)
rootSession, err = h.iam.AuthService.OpenSessionWithOIDC(ctx, identity.ID, coredata.AuthMethodOIDC)
if err != nil {
h.logger.ErrorCtx(ctx, "cannot open root session", log.Error(err))
httpserver.RenderError(w, http.StatusInternalServerError, errors.New("internal server error"))
@@ -136,7 +128,7 @@ func (h *OIDCHandler) CallbackHandler(w http.ResponseWriter, r *http.Request) {
return
}
rootSession, err = h.iam.AuthService.OpenSessionWithOIDC(ctx, identity.ID, authMethod)
rootSession, err = h.iam.AuthService.OpenSessionWithOIDC(ctx, identity.ID, coredata.AuthMethodOIDC)
if err != nil {
h.logger.ErrorCtx(ctx, "cannot open root session", log.Error(err))
httpserver.RenderError(w, http.StatusInternalServerError, errors.New("internal server error"))