throw new ServletException("This filter can only process HttpServletRequest requests.");
}
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
Identity identity = getIdentity();
DefaultLoginCredentials creds = extractCredentials(request);
if (creds.getCredential() != null && this.forceReAuthentication) {
identity.logout();
creds = extractCredentials(request);
}
if (isProtected(request) && !identity.isLoggedIn()) {
// Force session creation
request.getSession();
if (creds.getCredential() != null) {
identity.login();
}
if (identity.isLoggedIn()) {
if (this.authenticationScheme.postAuthentication(request, response)) {
chain.doFilter(servletRequest, servletResponse);
}
} else {
this.authenticationScheme.challengeClient(request, response);