Fix Charset to UTF-8 used by token value hash function (#11)
parent
29ec962d01
commit
19243821ed
|
@ -22,7 +22,7 @@
|
|||
<parent>
|
||||
<artifactId>openid-connect-parent</artifactId>
|
||||
<groupId>org.mitre</groupId>
|
||||
<version>1.3.6.cnaf-20231129</version>
|
||||
<version>1.3.6.cnaf-20240119</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openid-connect-client</artifactId>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<parent>
|
||||
<artifactId>openid-connect-parent</artifactId>
|
||||
<groupId>org.mitre</groupId>
|
||||
<version>1.3.6.cnaf-20231129</version>
|
||||
<version>1.3.6.cnaf-20240119</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openid-connect-common</artifactId>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
package org.mitre.oauth2.model;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -349,9 +350,8 @@ public class OAuth2AccessTokenEntity implements OAuth2AccessToken {
|
|||
|
||||
public void hashMe() {
|
||||
if (jwtValue != null) {
|
||||
this.tokenValueHash = Hashing.sha256()
|
||||
.hashUnencodedChars(jwtValue.serialize())
|
||||
.toString();
|
||||
this.tokenValueHash =
|
||||
Hashing.sha256().hashString(jwtValue.serialize(), StandardCharsets.UTF_8).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<groupId>org.mitre</groupId>
|
||||
<artifactId>openid-connect-parent</artifactId>
|
||||
<version>1.3.6.cnaf-20231129</version>
|
||||
<version>1.3.6.cnaf-20240119</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<build>
|
||||
|
|
|
@ -80,11 +80,9 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OAuth2AccessTokenEntity getAccessTokenByValue(
|
||||
String accessTokenValue) {
|
||||
String atHashed = Hashing.sha256()
|
||||
.hashUnencodedChars(accessTokenValue)
|
||||
.toString();
|
||||
public OAuth2AccessTokenEntity getAccessTokenByValue(String accessTokenValue) {
|
||||
String atHashed =
|
||||
Hashing.sha256().hashString(accessTokenValue, StandardCharsets.UTF_8).toString();
|
||||
TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery(
|
||||
OAuth2AccessTokenEntity.QUERY_BY_TOKEN_VALUE_HASH,
|
||||
OAuth2AccessTokenEntity.class);
|
||||
|
|
Loading…
Reference in New Issue