summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_oauth_introspection.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2023-08-05 06:44:21 +1000
committerGitHub <noreply@github.com>2023-08-05 06:44:21 +1000
commitf09dbee8ef34b448089d7c066d042e8076d52402 (patch)
tree04845a625283aa8ae3efcb143a3257a72f778c16 /internal/handlers/handler_oauth_introspection.go
parent0919173013a680f48a4ad2ada53974f879334a87 (diff)
fix(oidc): insufficient debug logs on some endpoints (#5783)
This fixes an issue where on the userinfo, introspection, and revocation endpoints there are not sufficient logs at the debug level to see the flow of a the request. Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/handlers/handler_oauth_introspection.go')
-rw-r--r--internal/handlers/handler_oauth_introspection.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/internal/handlers/handler_oauth_introspection.go b/internal/handlers/handler_oauth_introspection.go
index 0a86774bf..3fa1882e5 100644
--- a/internal/handlers/handler_oauth_introspection.go
+++ b/internal/handlers/handler_oauth_introspection.go
@@ -3,6 +3,7 @@ package handlers
import (
"net/http"
+ "github.com/google/uuid"
"github.com/ory/fosite"
"github.com/authelia/authelia/v4/internal/middlewares"
@@ -14,16 +15,25 @@ import (
// https://datatracker.ietf.org/doc/html/rfc7662
func OAuthIntrospectionPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter, req *http.Request) {
var (
+ requestID uuid.UUID
responder fosite.IntrospectionResponder
err error
)
+ if requestID, err = uuid.NewRandom(); err != nil {
+ ctx.Providers.OpenIDConnect.WriteIntrospectionError(ctx, rw, fosite.ErrServerError)
+
+ return
+ }
+
oidcSession := oidc.NewSession()
+ ctx.Logger.Debugf("Introspection Request with id '%s' is being processed", requestID)
+
if responder, err = ctx.Providers.OpenIDConnect.NewIntrospectionRequest(ctx, req, oidcSession); err != nil {
rfc := fosite.ErrorToRFC6749Error(err)
- ctx.Logger.Errorf("Introspection Request failed with error: %s", rfc.WithExposeDebug(true).GetDescription())
+ ctx.Logger.Errorf("Introspection Request with id '%s' failed with error: %s", requestID, rfc.WithExposeDebug(true).GetDescription())
ctx.Providers.OpenIDConnect.WriteIntrospectionError(ctx, rw, err)
@@ -32,7 +42,9 @@ func OAuthIntrospectionPOST(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter
requester := responder.GetAccessRequester()
- ctx.Logger.Tracef("Introspection Request yeilded a %s (active: %t) requested at %s created with request id '%s' on client with id '%s'", responder.GetTokenUse(), responder.IsActive(), requester.GetRequestedAt().String(), requester.GetID(), requester.GetClient().GetID())
+ ctx.Logger.Tracef("Introspection Request with id '%s' yeilded a %s (active: %t) requested at %s created with request id '%s' on client with id '%s'", requestID, responder.GetTokenUse(), responder.IsActive(), requester.GetRequestedAt().String(), requester.GetID(), requester.GetClient().GetID())
ctx.Providers.OpenIDConnect.WriteIntrospectionResponse(ctx, rw, responder)
+
+ ctx.Logger.Debugf("Introspection Request with id '%s' was processed successfully", requestID)
}