summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_oauth_introspection.go
diff options
context:
space:
mode:
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)
}