mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Change OAuthAutheticator to get api version and context
This commit is contained in:
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…
Reference in New Issue
Block a user