Removed OIDC Client credential
This commit is contained in:
parent
67a851a5d1
commit
dab0deea20
|
@ -6,7 +6,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
- Refactored code to be integrated in Smartgears [#22871]
|
- Refactored code to be integrated in Smartgears [#22871]
|
||||||
- Fixed getRoles for JWTSecret [#22754]
|
- Fixed getRoles for JWTSecret [#22754]
|
||||||
- Added OIDC Client credential [#23089]
|
|
||||||
|
|
||||||
## [v1.0.0]
|
## [v1.0.0]
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,18 @@ package org.gcube.common.authorization.utils.clientid;
|
||||||
|
|
||||||
import org.gcube.common.authorization.utils.secret.JWTSecret;
|
import org.gcube.common.authorization.utils.secret.JWTSecret;
|
||||||
import org.gcube.common.authorization.utils.secret.Secret;
|
import org.gcube.common.authorization.utils.secret.Secret;
|
||||||
import org.gcube.common.keycloak.KeycloakClientException;
|
|
||||||
import org.gcube.common.keycloak.KeycloakClientFactory;
|
import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||||
import org.gcube.common.keycloak.model.TokenResponse;
|
import org.gcube.common.keycloak.model.TokenResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
public class ClienIDManager implements RenewalProvider {
|
public class ClientIDManager implements RenewalProvider {
|
||||||
|
|
||||||
protected final String clientID;
|
protected final String clientID;
|
||||||
protected final String clientSecret;
|
protected final String clientSecret;
|
||||||
|
|
||||||
public ClienIDManager(String clientID, String clientSecret) {
|
public ClientIDManager(String clientID, String clientSecret) {
|
||||||
this.clientID = clientID;
|
this.clientID = clientID;
|
||||||
this.clientSecret = clientSecret;
|
this.clientSecret = clientSecret;
|
||||||
}
|
}
|
||||||
|
@ -40,20 +39,10 @@ public class ClienIDManager implements RenewalProvider {
|
||||||
|
|
||||||
return jwtSecret;
|
return jwtSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Secret getOIDCSecret() throws KeycloakClientException {
|
|
||||||
TokenResponse tokenResponse = KeycloakClientFactory.newInstance().queryOIDCToken(clientID, clientSecret);
|
|
||||||
|
|
||||||
JWTSecret jwtSecret = new JWTSecret(tokenResponse.getAccessToken());
|
|
||||||
jwtSecret.setRenewalProvider(this);
|
|
||||||
|
|
||||||
jwtSecret.setTokenResponse(tokenResponse);
|
|
||||||
|
|
||||||
return jwtSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Secret renew() throws Exception {
|
public Secret renew() throws Exception {
|
||||||
return getSecret();
|
return getSecret();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue