From 7b6b2f54b7fda31a47cd7e68ca8485dedeb0e1ed Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Date: Thu, 11 Apr 2019 21:45:28 -0700 Subject: [PATCH] Update http.go Add to the existing request context. --- spnego/http.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spnego/http.go b/spnego/http.go index 744b6f7c..2b9bdd15 100644 --- a/spnego/http.go +++ b/spnego/http.go @@ -237,10 +237,11 @@ func SPNEGOKRB5Authenticate(inner http.Handler, kt *keytab.Keytab, settings ...f } if authed { id := ctx.Value(CTXKeyCredentials).(goidentity.Identity) - context.WithValue(r.Context(), CTXKeyCredentials, id) - context.WithValue(r.Context(), CTXKeyAuthenticated, ctx.Value(CTXKeyAuthenticated)) + requestCtx := r.Context() + requestCtx = context.WithValue(requestCtx, CTXKeyCredentials, id) + requestCtx = context.WithValue(requestCtx, CTXKeyAuthenticated, ctx.Value(CTXKeyAuthenticated)) spnegoResponseAcceptCompleted(spnego, w, "%s %s@%s - SPNEGO authentication succeeded", r.RemoteAddr, id.UserName(), id.Domain()) - inner.ServeHTTP(w, r.WithContext(ctx)) + inner.ServeHTTP(w, r.WithContext(requestCtx)) } else { spnegoResponseReject(spnego, w, "%s - SPNEGO Kerberos authentication failed", r.RemoteAddr) }