diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java index 113c083c3a8..20fca28b316 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java @@ -55,28 +55,16 @@ public class OAuthAuthenticator implements WebappAuthenticator { } StringTokenizer tokenizer = new StringTokenizer(requestUri, "/"); - String context = request.getContextPath(); + String context = tokenizer.nextToken(); if (context == null || "".equals(context)) { - context = tokenizer.nextToken(); - if (context == null || "".equals(context)) { - return Status.CONTINUE; - } + return Status.CONTINUE; } - -// boolean isContextCached = false; -// if (APIUtil.getAPIContextCache().get(context) != null) { -// isContextCached = Boolean.parseBoolean(APIUtil.getAPIContextCache().get(context).toString()); -// } -// if (!isContextCached) { -// return Status.CONTINUE; -// } + String apiVersion = tokenizer.nextToken(); + String domain = request.getHeader(APITokenValidator.getAPIManagerClientDomainHeader()); + String authLevel = authenticator.getResourceAuthenticationScheme(context, apiVersion, + request.getRequestURI(), request.getMethod()); try { - String apiVersion = tokenizer.nextToken(); - String domain = request.getHeader(APITokenValidator.getAPIManagerClientDomainHeader()); - String authLevel = authenticator.getResourceAuthenticationScheme(context, apiVersion, - request.getRequestURI(), request.getMethod()); - if (Constants.NO_MATCHING_AUTH_SCHEME.equals(authLevel)) { AuthenticationFrameworkUtil.handleNoMatchAuthScheme(request, response, request.getMethod(), apiVersion, context);