Optimized the authenticator framework

merge-requests/7/head
harshanl 9 years ago
parent fa92aecf58
commit 2b9239d208

@ -36,7 +36,6 @@ import java.util.StringTokenizer;
public class WebappAuthenticationValve extends CarbonTomcatValve { public class WebappAuthenticationValve extends CarbonTomcatValve {
private static final Log log = LogFactory.getLog(WebappAuthenticationValve.class); private static final Log log = LogFactory.getLog(WebappAuthenticationValve.class);
private static final String BYPASS_URIS = "bypass-uris";
private static HashMap<String, String> nonSecuredEndpoints = new HashMap<>(); private static HashMap<String, String> nonSecuredEndpoints = new HashMap<>();
@Override @Override
@ -47,21 +46,6 @@ public class WebappAuthenticationValve extends CarbonTomcatValve {
return; return;
} }
String byPassURIs = request.getContext().findParameter(WebappAuthenticationValve.BYPASS_URIS);
if (byPassURIs != null && !byPassURIs.isEmpty()) {
List<String> requestURI = Arrays.asList(byPassURIs.split(","));
if (requestURI != null && requestURI.size() > 0) {
for (String pathURI : requestURI) {
pathURI = pathURI.replace("\n", "").replace("\r", "").trim();
if (request.getRequestURI().equals(pathURI)) {
this.getNext().invoke(request, response, compositeValve);
return;
}
}
}
}
WebappAuthenticator authenticator = WebappAuthenticatorFactory.getAuthenticator(request); WebappAuthenticator authenticator = WebappAuthenticatorFactory.getAuthenticator(request);
if (authenticator == null) { if (authenticator == null) {
String msg = "Failed to load an appropriate authenticator to authenticate the request"; String msg = "Failed to load an appropriate authenticator to authenticate the request";
@ -131,6 +115,7 @@ public class WebappAuthenticationValve extends CarbonTomcatValve {
StringTokenizer tokenizer = new StringTokenizer(param, ","); StringTokenizer tokenizer = new StringTokenizer(param, ",");
while (tokenizer.hasMoreTokens()) { while (tokenizer.hasMoreTokens()) {
skippedEndPoint = ctx + tokenizer.nextToken(); skippedEndPoint = ctx + tokenizer.nextToken();
skippedEndPoint = skippedEndPoint.replace("\n", "").replace("\r", "").trim();
if(!skippedEndPoint.endsWith("/")) { if(!skippedEndPoint.endsWith("/")) {
skippedEndPoint = skippedEndPoint + "/"; skippedEndPoint = skippedEndPoint + "/";
} }

Loading…
Cancel
Save