From f97474f01b6a7efcebfe0f2c75222bbe718a3259 Mon Sep 17 00:00:00 2001 From: James Elliott Date: Tue, 12 Apr 2022 21:39:15 +1000 Subject: [PATCH] fix(oidc): show detailed error reasons (#3175) --- internal/handlers/handler_oauth_introspection.go | 2 +- internal/handlers/handler_oauth_revocation.go | 2 +- internal/handlers/handler_oidc_authorization.go | 4 ++-- internal/handlers/handler_oidc_token.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/handlers/handler_oauth_introspection.go b/internal/handlers/handler_oauth_introspection.go index 331ce201d..990e8c5c2 100644 --- a/internal/handlers/handler_oauth_introspection.go +++ b/internal/handlers/handler_oauth_introspection.go @@ -23,7 +23,7 @@ func OAuthIntrospectionPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter if responder, err = ctx.Providers.OpenIDConnect.Fosite.NewIntrospectionRequest(ctx, req, oidcSession); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Introspection Request failed with error: %+v", rfc) + ctx.Logger.Errorf("Introspection Request failed with error: %s", rfc.GetDescription()) ctx.Providers.OpenIDConnect.Fosite.WriteIntrospectionError(rw, err) diff --git a/internal/handlers/handler_oauth_revocation.go b/internal/handlers/handler_oauth_revocation.go index 1dad867bc..6f86596b1 100644 --- a/internal/handlers/handler_oauth_revocation.go +++ b/internal/handlers/handler_oauth_revocation.go @@ -17,7 +17,7 @@ func OAuthRevocationPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter, r if err = ctx.Providers.OpenIDConnect.Fosite.NewRevocationRequest(ctx, req); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Revocation Request failed with error: %+v", rfc) + ctx.Logger.Errorf("Revocation Request failed with error: %s", rfc.GetDescription()) } ctx.Providers.OpenIDConnect.Fosite.WriteRevocationResponse(rw, err) diff --git a/internal/handlers/handler_oidc_authorization.go b/internal/handlers/handler_oidc_authorization.go index c1d34c955..8344550b2 100644 --- a/internal/handlers/handler_oidc_authorization.go +++ b/internal/handlers/handler_oidc_authorization.go @@ -29,7 +29,7 @@ func OpenIDConnectAuthorizationGET(ctx *middlewares.AutheliaCtx, rw http.Respons if requester, err = ctx.Providers.OpenIDConnect.Fosite.NewAuthorizeRequest(ctx, r); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Authorization Request failed with error: %+v", rfc) + ctx.Logger.Errorf("Authorization Request failed with error: %s", rfc.GetDescription()) ctx.Providers.OpenIDConnect.Fosite.WriteAuthorizeError(rw, requester, err) @@ -104,7 +104,7 @@ func OpenIDConnectAuthorizationGET(ctx *middlewares.AutheliaCtx, rw http.Respons if responder, err = ctx.Providers.OpenIDConnect.Fosite.NewAuthorizeResponse(ctx, requester, oidcSession); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Authorization Response for Request with id '%s' on client with id '%s' could not be created: %+v", requester.GetID(), clientID, rfc) + ctx.Logger.Errorf("Authorization Response for Request with id '%s' on client with id '%s' could not be created: %s", requester.GetID(), clientID, rfc.GetDescription()) ctx.Providers.OpenIDConnect.Fosite.WriteAuthorizeError(rw, requester, err) diff --git a/internal/handlers/handler_oidc_token.go b/internal/handlers/handler_oidc_token.go index 59a9a55eb..c46afa358 100644 --- a/internal/handlers/handler_oidc_token.go +++ b/internal/handlers/handler_oidc_token.go @@ -24,7 +24,7 @@ func OpenIDConnectTokenPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter if requester, err = ctx.Providers.OpenIDConnect.Fosite.NewAccessRequest(ctx, req, oidcSession); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Access Request failed with error: %+v", rfc) + ctx.Logger.Errorf("Access Request failed with error: %s", rfc.GetDescription()) ctx.Providers.OpenIDConnect.Fosite.WriteAccessError(rw, requester, err) @@ -47,7 +47,7 @@ func OpenIDConnectTokenPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter if responder, err = ctx.Providers.OpenIDConnect.Fosite.NewAccessResponse(ctx, requester); err != nil { rfc := fosite.ErrorToRFC6749Error(err) - ctx.Logger.Errorf("Access Response for Request with id '%s' failed to be created with error: %+v", requester.GetID(), rfc) + ctx.Logger.Errorf("Access Response for Request with id '%s' failed to be created with error: %s", requester.GetID(), rfc.GetDescription()) ctx.Providers.OpenIDConnect.Fosite.WriteAccessError(rw, requester, err)