You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were using this before it was packaged into a library (thanks!) and now we're integrating this library and dropping most of the original code.
AccessTokenClaims on DPoPProofValidationContext is empty, causing the new lookup for cnf to fail in `ValidateHeader.'
The DPoPJwtBearerEvents.TokenValidated event is parsing the AT with a JsonWebTokenHandler, but we have encrypted JWTs which produces an empty array and causes the `DPoPValidation.
Since we are in the TokenValidated event, can we default to (or fall back to) the context's Principal claims? At that point the token has been decrypted and validated by the Jwt handler as we'd expect. Using context.Princpal.Claims works as expected, with the original claims from our AT.
Alternatively we could use handler.ValidateToken(TokenValidationParameters) but that would require us to re-configure our validation params to include the decryption key resolver, which seems duplicative.
I personally do not know of a reason why the context claims would be untrustworthy, particularly since handler.ReadJsonWebToken does no validation on the AT.
// TODO - Add support for introspectionvarhandler=newJsonWebTokenHandler();varparsedToken=handler.ReadJsonWebToken(at);varresult=await_validator.Validate(newDPoPProofValidationContext{Scheme=context.Scheme.Name,ProofToken=proofToken,AccessToken=at,// get the context claims hereAccessTokenClaims=context.Principal?.Claims??parsedToken.Claims??[],Method=context.HttpContext.Request.Method,Url=context.HttpContext.Request.Scheme+"://"+context.HttpContext.Request.Host+context.HttpContext.Request.PathBase+context.HttpContext.Request.Path});
thanks!
The text was updated successfully, but these errors were encountered:
jpda
added a commit
to jpda/aspnetcore
that referenced
this issue
Dec 10, 2024
We were using this before it was packaged into a library (thanks!) and now we're integrating this library and dropping most of the original code.
AccessTokenClaims
onDPoPProofValidationContext
is empty, causing the new lookup forcnf
to fail in `ValidateHeader.'The
DPoPJwtBearerEvents.TokenValidated
event is parsing the AT with aJsonWebTokenHandler
, but we have encrypted JWTs which produces an empty array and causes the `DPoPValidation.Since we are in the
TokenValidated
event, can we default to (or fall back to) the context'sPrincipal
claims? At that point the token has been decrypted and validated by the Jwt handler as we'd expect. Usingcontext.Princpal.Claims
works as expected, with the original claims from our AT.Alternatively we could use
handler.ValidateToken(TokenValidationParameters)
but that would require us to re-configure our validation params to include the decryption key resolver, which seems duplicative.I personally do not know of a reason why the context claims would be untrustworthy, particularly since
handler.ReadJsonWebToken
does no validation on the AT.for example (from DPoPJwtBearerEvents.cs):
thanks!
The text was updated successfully, but these errors were encountered: