From 54290e0ab3f528d8876955e5be1ecf44f7b4cad6 Mon Sep 17 00:00:00 2001 From: manoj Date: Tue, 26 May 2015 13:01:20 +0530 Subject: [PATCH] Change OAuthAutheticator to get api version and context --- .../authenticator/OAuthAuthenticator.java | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) 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);