Switched to the new version of keycloak-client refs #25295
This commit is contained in:
parent
5a29295ca9
commit
c7af44e220
|
@ -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
|
||||
|
|
18
pom.xml
18
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-utils</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.4.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -62,7 +62,19 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>keycloak-client</artifactId>
|
||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Dependencies -->
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue