Change OAuthAutheticator to get api version and context

revert-70aa11f8
manoj 10 years ago
parent f2c33f9421
commit 54290e0ab3

@ -55,28 +55,16 @@ public class OAuthAuthenticator implements WebappAuthenticator {
} }
StringTokenizer tokenizer = new StringTokenizer(requestUri, "/"); StringTokenizer tokenizer = new StringTokenizer(requestUri, "/");
String context = request.getContextPath(); String context = tokenizer.nextToken();
if (context == null || "".equals(context)) { if (context == null || "".equals(context)) {
context = tokenizer.nextToken(); return Status.CONTINUE;
if (context == null || "".equals(context)) {
return Status.CONTINUE;
}
} }
String apiVersion = tokenizer.nextToken();
// boolean isContextCached = false; String domain = request.getHeader(APITokenValidator.getAPIManagerClientDomainHeader());
// if (APIUtil.getAPIContextCache().get(context) != null) { String authLevel = authenticator.getResourceAuthenticationScheme(context, apiVersion,
// isContextCached = Boolean.parseBoolean(APIUtil.getAPIContextCache().get(context).toString()); request.getRequestURI(), request.getMethod());
// }
// if (!isContextCached) {
// return Status.CONTINUE;
// }
try { 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)) { if (Constants.NO_MATCHING_AUTH_SCHEME.equals(authLevel)) {
AuthenticationFrameworkUtil.handleNoMatchAuthScheme(request, response, request.getMethod(), AuthenticationFrameworkUtil.handleNoMatchAuthScheme(request, response, request.getMethod(),
apiVersion, context); apiVersion, context);

Loading…
Cancel
Save