Skip to content

Commit

Permalink
Fix DPoPInterceptor when called after retry (#1536) (#1552)
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Denis <clement.denis@gmail.com>
  • Loading branch information
arvindkrishnakumar-okta and clementdenis authored Sep 3, 2024
1 parent cca0f7b commit c4a0037
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ private void processRequest(HttpRequest request, boolean tokenRequest) {
Header authorization = request.getFirstHeader("Authorization");
if (authorization != null) {
//already authenticated, need to replace Authorization header prefix and set ath claim
String token = authorization.getValue().replaceFirst("^Bearer ", "");
//the DPoP prefix might already be set if the request is retried
String token = StringUtils.substringAfter(authorization.getValue(), " ");
request.setHeader("Authorization", DPOP_HEADER + " " + token);
byte[] ath = SHA256.digest(token.getBytes(StandardCharsets.US_ASCII));
builder.claim("ath", Encoders.BASE64URL.encode(ath));
Expand Down

0 comments on commit c4a0037

Please sign in to comment.