Skip to content

Commit

Permalink
fix: Fixed a bug due to the transformation of '/' in '_' in Base64 en…
Browse files Browse the repository at this point in the history
…coded strings. (#58)
  • Loading branch information
antoniotarricone authored Jul 4, 2023
1 parent 5214beb commit 5a78042
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ private Uni<User> findCredentials(GetAccessToken getAccessToken) {
userHash = Base64.getEncoder().encodeToString(
MessageDigest.getInstance("SHA256").digest(
getAccessToken.getUsername().getBytes(StandardCharset.UTF_8)))
.replace("+", "-");
.replace("+", "-")
.replace("/", "_");
} catch (NoSuchAlgorithmException e) {
String message = String.format("[%s] Error searching for the credentials.", ERROR_SEARCHING_FOR_CREDENTIALS);
Log.errorf(e, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class TokenResourceTest {
void generateUserHash() throws NoSuchAlgorithmException {
userHash = Base64.getEncoder().encodeToString(
MessageDigest.getInstance("SHA256").digest(
USER_NAME.getBytes(StandardCharset.UTF_8)));
USER_NAME.getBytes(StandardCharset.UTF_8)))
.replace("+", "-")
.replace("/", "_");
}

/**
Expand Down

0 comments on commit 5a78042

Please sign in to comment.