updated logs

This commit is contained in:
Francesco Mangiacrapa 2024-05-06 12:03:41 +02:00
parent 7c1f0ad829
commit 13c271ca37
2 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,6 @@ public class IAMClientIdentity implements GcubeIdentity {
}
LOG.trace("Read credentials: " + credentials);
String umaAcessToken = null;
clientId = credentials.getClientId();
String clientSecret = credentials.getClientSecret();
try {
@ -49,10 +48,9 @@ public class IAMClientIdentity implements GcubeIdentity {
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(currentScope, clientId, clientSecret, currentScope,
null);
umaAcessToken = tr.getAccessToken();
if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
currentUMAToken = tr.getAccessToken();
if (currentUMAToken != null && !currentUMAToken.isEmpty()) {
LOG.info("UMA Access Token read correctly");
currentUMAToken = umaAcessToken;
} else {
LOG.error("UMA Access Token NOT RETRIEVED!!!");
throw new Exception("UMA Access Token is null or empty");
@ -63,6 +61,8 @@ public class IAMClientIdentity implements GcubeIdentity {
try {
LOG.debug("JWT token: " + currentUMAToken.substring(0, 20) + "_MASKED_TOKEN_");
try {
// Here the previousUMAToken should be null
previousUMAToken = AccessTokenProvider.instance.get();
@ -71,10 +71,9 @@ public class IAMClientIdentity implements GcubeIdentity {
// silent
}
LOG.debug("JWT token: " + umaAcessToken.substring(0, 20) + "_MASKED_TOKEN_");
LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
+ AccessTokenProvider.class.getSimpleName());
AccessTokenProvider.instance.set(umaAcessToken);
AccessTokenProvider.instance.set(currentUMAToken);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new Exception(e.getMessage());

View File

@ -22,8 +22,8 @@ public class UserIdentity implements GcubeIdentity {
public void setIdentity(HttpServletRequest httpRequest) throws Exception {
LOG.info("setIdentity called");
this.httpRequest = httpRequest;
SessionUtil.getCurrentToken(httpRequest, true);
user = SessionUtil.getCurrentUser(httpRequest);
SessionUtil.getCurrentToken(this.httpRequest, true);
user = SessionUtil.getCurrentUser(this.httpRequest);
}
@ -35,7 +35,7 @@ public class UserIdentity implements GcubeIdentity {
@Override
public String getToken() {
return SessionUtil.getCurrentToken(httpRequest, true);
return SessionUtil.getCurrentToken(this.httpRequest, true);
}
@Override