Skip to content

Commit

Permalink
EPA-156: Remove padding from code_verifier (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrichner-oviva authored Oct 16, 2024
1 parent 6d83386 commit 40a7b78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ private static String calculateS256CodeChallenge(String codeVerifier) {
private static String generatePkceCodeVerifier() {
var rng = new SecureRandom();

// https://datatracker.ietf.org/doc/html/rfc7636#section-4.1
var bytes = new byte[32];
rng.nextBytes(bytes);
return Base64.getUrlEncoder().encodeToString(bytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
}

// Authorization Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ private String generateCodeVerifier() {

var bytes = new byte[32];
rng.nextBytes(bytes);
return Base64.getUrlEncoder().encodeToString(bytes);
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
}
}

0 comments on commit 40a7b78

Please sign in to comment.