diff --git a/client/src/main/java/io/pravega/keycloak/client/KeycloakAuthzClient.java b/client/src/main/java/io/pravega/keycloak/client/KeycloakAuthzClient.java index 9ea6ae6..9196476 100644 --- a/client/src/main/java/io/pravega/keycloak/client/KeycloakAuthzClient.java +++ b/client/src/main/java/io/pravega/keycloak/client/KeycloakAuthzClient.java @@ -199,7 +199,7 @@ public void update(AuthorizationResponse response) { } boolean isTokenTimeToLiveSufficient() { - return token.getExpiration() - tokenMinimumTimeToLiveSecs > Time.currentTime(); + return token.getExp() - tokenMinimumTimeToLiveSecs > Time.currentTime(); } } diff --git a/client/src/test/java/io/pravega/keycloak/client/helpers/AccessTokenIssuer.java b/client/src/test/java/io/pravega/keycloak/client/helpers/AccessTokenIssuer.java index 0d85301..388b05d 100644 --- a/client/src/test/java/io/pravega/keycloak/client/helpers/AccessTokenIssuer.java +++ b/client/src/test/java/io/pravega/keycloak/client/helpers/AccessTokenIssuer.java @@ -15,6 +15,7 @@ import org.keycloak.common.util.KeyUtils; import org.keycloak.jose.jws.JWSBuilder; import org.keycloak.representations.AccessToken; +import org.keycloak.common.crypto.CryptoIntegration; import java.security.KeyPair; import java.security.PublicKey; @@ -32,6 +33,7 @@ public class AccessTokenIssuer implements PublicKeyLocator { private final KeyPair issuerKeyPair; public AccessTokenIssuer() { + CryptoIntegration.init(null); issuerKeyPair = KeyUtils.generateRsaKeyPair(2048); } @@ -71,7 +73,7 @@ public String issue(AccessToken accessToken) { * @return */ private static int computeExpiration(AccessToken token, Duration expiration) { - int issuedAt = token.getIssuedAt(); + int issuedAt = token.getIat().intValue(); int expirationInSeconds = (int) expiration.toMillis() / 1000; return issuedAt + expirationInSeconds; } diff --git a/gradle.properties b/gradle.properties index fc62866..59c1aec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ guavaVersion=28.2-jre junitVersion=4.13.2 -keycloakVersion=15.1.1 +keycloakVersion=19.0.3 mockitoVersion=3.3.3 pravegaVersion=0.12.0 slf4jVersion=1.7.30