diff --git a/CHANGELOG.md b/CHANGELOG.md index 148fa39..7fb970b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for Authorization Utils +## [v2.2.0-SNAPSHOT] + +- Switched to the new version of keycloak-client [#25295] + + ## [v2.1.0] - Added remove() method in SecretManagerProvider @@ -9,7 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v2.0.0] -- Refactored code to be integrated in Smartgears [#22871] +- Refactored code to be integrated in Smartgears [#22871] - Fixed getRoles for JWTSecret [#22754] ## [v1.0.0] diff --git a/pom.xml b/pom.xml index d8018dc..77c2500 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.common authorization-utils - 2.1.0 + 2.2.0-SNAPSHOT UTF-8 @@ -27,7 +27,7 @@ org.gcube.distribution gcube-bom - 2.2.0 + 2.4.0-SNAPSHOT pom import @@ -62,7 +62,19 @@ org.gcube.common keycloak-client - [1.0.0,2.0.0-SNAPSHOT) + + + + org.gcube.resources + common-gcore-resources + + + org.gcube.resources.discovery + ic-client + + + org.gcube.resources.discovery + discovery-client diff --git a/src/main/java/org/gcube/common/authorization/utils/clientid/ClientIDManager.java b/src/main/java/org/gcube/common/authorization/utils/clientid/ClientIDManager.java index 81b92f5..978ffcd 100644 --- a/src/main/java/org/gcube/common/authorization/utils/clientid/ClientIDManager.java +++ b/src/main/java/org/gcube/common/authorization/utils/clientid/ClientIDManager.java @@ -18,17 +18,6 @@ public class ClientIDManager implements RenewalProvider { this.clientSecret = clientSecret; } - public Secret getSecret() throws Exception { - TokenResponse tokenResponse = KeycloakClientFactory.newInstance().queryUMAToken(clientID, clientSecret, null); - - JWTSecret jwtSecret = new JWTSecret(tokenResponse.getAccessToken()); - jwtSecret.setRenewalProvider(this); - - jwtSecret.setTokenResponse(tokenResponse); - - return jwtSecret; - } - public Secret getSecret(String context) throws Exception { TokenResponse tokenResponse = KeycloakClientFactory.newInstance().queryUMAToken(clientID, clientSecret, context, null); @@ -41,8 +30,8 @@ public class ClientIDManager implements RenewalProvider { } @Override - public Secret renew() throws Exception { - return getSecret(); + public Secret renew(String context) throws Exception { + return getSecret(context); } } diff --git a/src/main/java/org/gcube/common/authorization/utils/clientid/RenewalProvider.java b/src/main/java/org/gcube/common/authorization/utils/clientid/RenewalProvider.java index 003b29f..6624a85 100644 --- a/src/main/java/org/gcube/common/authorization/utils/clientid/RenewalProvider.java +++ b/src/main/java/org/gcube/common/authorization/utils/clientid/RenewalProvider.java @@ -7,5 +7,5 @@ import org.gcube.common.authorization.utils.secret.Secret; */ public interface RenewalProvider { - public Secret renew() throws Exception; + public Secret renew(String context) throws Exception; } diff --git a/src/main/java/org/gcube/common/authorization/utils/secret/JWTSecret.java b/src/main/java/org/gcube/common/authorization/utils/secret/JWTSecret.java index 147a32c..fdec359 100644 --- a/src/main/java/org/gcube/common/authorization/utils/secret/JWTSecret.java +++ b/src/main/java/org/gcube/common/authorization/utils/secret/JWTSecret.java @@ -76,7 +76,7 @@ public class JWTSecret extends Secret { if(expired && renewalProvider!=null) { try { - JWTSecret renewed = (JWTSecret) renewalProvider.renew(); + JWTSecret renewed = (JWTSecret) renewalProvider.renew(getContext()); this.token = renewed.token; this.accessToken = getAccessToken(); }catch (Exception e) {