Now mapping is fault tollerant to support all kind of clients

This commit is contained in:
Mauro Mugnaini 2020-06-26 18:10:27 +02:00
parent db882bd0bf
commit faf59e9d00
1 changed files with 9 additions and 2 deletions

View File

@ -7,6 +7,8 @@ import java.util.Map;
public class SlashSeparatedContextMapper extends AbstractOIDCToSitesAndRolesMapper {
private static final Boolean FAULT_TOLLERANT = Boolean.TRUE;
private static final String SPLIT_REGEXP = "/";
private static final int MINIMUM_TOKENS = 2;
@ -40,8 +42,13 @@ public class SlashSeparatedContextMapper extends AbstractOIDCToSitesAndRolesMapp
logger.debug("Tokens are: " + siteTokens.length);
}
if (siteTokens.length < MINIMUM_TOKENS) {
throw new SitesMapperExecption(
"Found " + siteTokens.length + " tokens only. Minimum should be: " + MINIMUM_TOKENS);
String message = "Found " + siteTokens.length + " tokens only. Minimum should be: " + MINIMUM_TOKENS;
if (FAULT_TOLLERANT) {
logger.warn(message);
continue;
} else {
throw new SitesMapperExecption(message);
}
}
String rootVO = siteTokens[ROOT_VO_TOKEN_INDEX];
if (logger.isDebugEnabled()) {