Simply ignoring resources that not start with slash ('/') and removed warn level log for it.

This commit is contained in:
Mauro Mugnaini 2021-01-27 17:09:15 +01:00
parent 1e48c3ce03
commit c75eb8af91
1 changed files with 3 additions and 12 deletions

View File

@ -12,12 +12,8 @@ public class SlashSeparatedContextMapper extends AbstractOIDCToSitesAndRolesMapp
protected static final Logger logger = LoggerFactory.getLogger(SlashSeparatedContextMapper.class);
private static final Boolean FAULT_TOLERANT = Boolean.TRUE;
private static final String SPLIT_REGEXP = "/";
private static final int MINIMUM_TOKENS = 2;
private static final int EMPTY_TOKEN_INDEX = 0;
private static final int ROOT_VO_TOKEN_INDEX = EMPTY_TOKEN_INDEX + 1;
@ -42,14 +38,9 @@ public class SlashSeparatedContextMapper extends AbstractOIDCToSitesAndRolesMapp
logger.debug("Roles for site are: {}", roles);
String[] siteTokens = site.split(SPLIT_REGEXP);
logger.debug("Tokens are: {}", siteTokens.length);
if (siteTokens.length < MINIMUM_TOKENS) {
String message = "Found " + siteTokens.length + " tokens only. Minimum should be: " + MINIMUM_TOKENS;
if (FAULT_TOLERANT) {
logger.warn(message);
continue;
} else {
throw new SitesMapperExecption(message);
}
if (siteTokens.length < 2) {
logger.debug("Skipping resource not starting with '{}'", SPLIT_REGEXP);
continue;
}
String rootVO = siteTokens[ROOT_VO_TOKEN_INDEX];
logger.debug("Root VO is: {}", rootVO);