From c75eb8af91e9ee3bc7d051ba3991bfbe1c7d3283 Mon Sep 17 00:00:00 2001 From: Mauro Mugnaini Date: Wed, 27 Jan 2021 17:09:15 +0100 Subject: [PATCH] Simply ignoring resources that not start with slash ('/') and removed warn level log for it. --- .../gcube/oidc/SlashSeparatedContextMapper.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/gcube/oidc/SlashSeparatedContextMapper.java b/src/main/java/org/gcube/oidc/SlashSeparatedContextMapper.java index 00d790d..2e7f1df 100644 --- a/src/main/java/org/gcube/oidc/SlashSeparatedContextMapper.java +++ b/src/main/java/org/gcube/oidc/SlashSeparatedContextMapper.java @@ -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);