refactor: Further deps and fixes

pull/1580/head
Dominik Frantisek Bucik 2021-12-03 14:34:10 +01:00
parent f646fe02e5
commit e2f801e419
No known key found for this signature in database
GPG Key ID: 25014C8DB2E7E62D
3 changed files with 31 additions and 15 deletions

View File

@ -119,6 +119,14 @@
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.servlet</artifactId>
@ -135,6 +143,10 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>

View File

@ -25,6 +25,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.nimbusds.jose.Algorithm;
import com.nimbusds.jose.JOSEObjectType;
import com.nimbusds.jose.JWEHeader;
import com.nimbusds.jose.JWEObject;
import com.nimbusds.jose.JWSAlgorithm;
@ -59,7 +60,6 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.stereotype.Service;
/**
* Default implementation of service to create specialty OpenID Connect tokens.
*
@ -140,7 +140,7 @@ public class DefaultOIDCTokenService implements OIDCTokenService {
if (responseTypes.contains("token")) {
// calculate the token hash
Base64URL at_hash = IdTokenHashUtils.getAccessTokenHash(signingAlg, accessToken);
idClaims.claim("at_hash", at_hash);
idClaims.claim("at_hash", at_hash.toString());
}
addCustomIdTokenClaims(idClaims, client, request, sub, accessToken);
@ -166,7 +166,6 @@ public class DefaultOIDCTokenService implements OIDCTokenService {
if (signingAlg.equals(Algorithm.NONE)) {
// unsigned ID token
idToken = new PlainJWT(idClaims.build());
} else {
// signed ID token
@ -175,7 +174,7 @@ public class DefaultOIDCTokenService implements OIDCTokenService {
|| signingAlg.equals(JWSAlgorithm.HS384)
|| signingAlg.equals(JWSAlgorithm.HS512)) {
JWSHeader header = new JWSHeader(signingAlg, null, null, null, null, null, null, null, null, null,
JWSHeader header = new JWSHeader(signingAlg, JOSEObjectType.JWT, null, null, null, null, null, null, null, null,
jwtService.getDefaultSignerKeyId(),
null, null);
idToken = new SignedJWT(header, idClaims.build());
@ -187,7 +186,7 @@ public class DefaultOIDCTokenService implements OIDCTokenService {
} else {
idClaims.claim("kid", jwtService.getDefaultSignerKeyId());
JWSHeader header = new JWSHeader(signingAlg, null, null, null, null, null, null, null, null, null,
JWSHeader header = new JWSHeader(signingAlg, JOSEObjectType.JWT, null, null, null, null, null, null, null, null,
jwtService.getDefaultSignerKeyId(),
null, null);

25
pom.xml
View File

@ -100,10 +100,10 @@
<eclipse-persistence-jpa.version>${eclipse-persistence.version}</eclipse-persistence-jpa.version>
<!-- LDAP -->
<apache-directory-api.version>2.1.0</apache-directory-api.version>
<apache-ldap-api-all.version>2.1.0</apache-ldap-api-all.version>
<!-- Logging -->
<logback.verison>1.2.7</logback.verison>
<logback.version>1.2.7</logback.version>
<!-- Testing -->
<junit.version>4.13.2</junit.version>
@ -208,6 +208,12 @@
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${hikari.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
@ -261,13 +267,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.verison}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- Other libraries -->
@ -320,7 +325,7 @@
<dependency>
<groupId>org.apache.directory.api</groupId>
<artifactId>api-all</artifactId>
<version>${apache-directory-api.version}</version>
<version>${apache-ldap-api-all.version}</version>
</dependency>
</dependencies>
</dependencyManagement>