Use unencoded hash function and bump version to v1.3.6.cnaf.20230726

pull/1611/head
Enrico Vianello 2023-07-26 10:55:10 +01:00
parent 07aeb26312
commit 521019fed8
6 changed files with 7 additions and 8 deletions

View File

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>openid-connect-parent</artifactId> <artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId> <groupId>org.mitre</groupId>
<version>1.3.6.cnaf-20230725</version> <version>1.3.6.cnaf-20230726</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>openid-connect-client</artifactId> <artifactId>openid-connect-client</artifactId>

View File

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>openid-connect-parent</artifactId> <artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId> <groupId>org.mitre</groupId>
<version>1.3.6.cnaf-20230725</version> <version>1.3.6.cnaf-20230726</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>openid-connect-common</artifactId> <artifactId>openid-connect-common</artifactId>

View File

@ -20,7 +20,6 @@
*/ */
package org.mitre.oauth2.model; package org.mitre.oauth2.model;
import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -282,7 +281,7 @@ public class OAuth2AccessTokenEntity implements OAuth2AccessToken {
* @return the tokenValueHash * @return the tokenValueHash
*/ */
@Basic @Basic
@Column(name = "token_value_hash") @Column(name = "token_value_hash", length = 64)
public String getTokenValueHash() { public String getTokenValueHash() {
return tokenValueHash; return tokenValueHash;
} }
@ -351,7 +350,7 @@ public class OAuth2AccessTokenEntity implements OAuth2AccessToken {
public void hashMe() { public void hashMe() {
if (jwtValue != null) { if (jwtValue != null) {
this.tokenValueHash = Hashing.sha256() this.tokenValueHash = Hashing.sha256()
.hashString(jwtValue.serialize(), StandardCharsets.UTF_8) .hashUnencodedChars(jwtValue.serialize())
.toString(); .toString();
} }
} }

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.mitre</groupId> <groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId> <artifactId>openid-connect-parent</artifactId>
<version>1.3.6.cnaf-20230725</version> <version>1.3.6.cnaf-20230726</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<build> <build>

View File

@ -83,7 +83,7 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository {
public OAuth2AccessTokenEntity getAccessTokenByValue( public OAuth2AccessTokenEntity getAccessTokenByValue(
String accessTokenValue) { String accessTokenValue) {
String atHashed = Hashing.sha256() String atHashed = Hashing.sha256()
.hashString(accessTokenValue, StandardCharsets.UTF_8) .hashUnencodedChars(accessTokenValue)
.toString(); .toString();
TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery( TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery(
OAuth2AccessTokenEntity.QUERY_BY_TOKEN_VALUE_HASH, OAuth2AccessTokenEntity.QUERY_BY_TOKEN_VALUE_HASH,

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.mitre</groupId> <groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId> <artifactId>openid-connect-parent</artifactId>
<version>1.3.6.cnaf-20230725</version> <version>1.3.6.cnaf-20230726</version>
<name>MITREid Connect</name> <name>MITREid Connect</name>
<packaging>pom</packaging> <packaging>pom</packaging>
<parent> <parent>