Skip to content

Commit

Permalink
Update http.go
Browse files Browse the repository at this point in the history
Add to the existing request context.
  • Loading branch information
shanmugh authored and jcmturner committed Apr 13, 2019
1 parent 8bb39e3 commit 7b6b2f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spnego/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7b6b2f5

Please sign in to comment.