Added some log messages

This commit is contained in:
Mauro Mugnaini 2024-04-03 15:30:00 +02:00
parent f3890b258f
commit ce4a29df73
Signed by: mauro.mugnaini
GPG Key ID: 2440CFD0EB321EA8
1 changed files with 5 additions and 3 deletions

View File

@ -100,12 +100,12 @@ public class D4ScienceContextMapper extends AbstractOIDCProtocolMapper implement
// Since only the OIDCAccessTokenMapper interface is implemented, we are almost sure that
// the token object is an AccessToken but adding a specific check anyway
if (token instanceof AccessToken) {
AccessToken accessToken = ((AccessToken) token);
AccessToken accessToken = (AccessToken) token;
String headerName = mappingModel.getConfig().get(HTTP_REQUEST_HEADER_NAME);
if (headerName == null || "".equals(headerName)) {
headerName = DEFAULT_HEADER_NAME;
}
logger.debugf("Looking for the '%s' header", headerName);
logger.tracef("Looking for the '%s' header", headerName);
String requestedD4SContext = keycloakSession.getContext().getRequestHeaders().getHeaderString(headerName);
if (requestedD4SContext != null && !"".equals(requestedD4SContext)) {
@ -118,7 +118,7 @@ public class D4ScienceContextMapper extends AbstractOIDCProtocolMapper implement
OIDCAttributeMapperHelper.mapClaim(token, mappingModel, requestedD4SContext);
if (Boolean.parseBoolean(mappingModel.getConfig().get(NARROW_RESOURCE_ACCESS))) {
// Removing all access details but the requested context
logger.debugf("Removing all access details but the requested context");
accessToken.getResourceAccess().clear();
accessToken.getResourceAccess().put(requestedD4SContext, contextAccessInResourceAccess);
}
@ -126,6 +126,8 @@ public class D4ScienceContextMapper extends AbstractOIDCProtocolMapper implement
logger.warnf("Requested context '%s' is not accessible to the client: %s", requestedD4SContext,
clientSessionCtx.getClientSession().getClient().getName());
}
} else {
logger.tracef("Header not found in request");
}
}
}