use of org.apache.sling.engine.impl.request.SlingRequestProgressTracker in project sling by apache.
the class SlingHttpContext method handleSecurity.
/**
* Tries to authenticate the request using the
* <code>SlingAuthenticator</code>. If the authenticator or the Repository
* is missing this method returns <code>false</code> and sends a 503/SERVICE
* UNAVAILABLE status back to the client.
*/
@Override
public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
final SlingRequestProgressTracker t = new SlingRequestProgressTracker(request);
request.setAttribute(RequestProgressTracker.class.getName(), t);
final String timerName = "handleSecurity";
t.startTimer(timerName);
final AuthenticationSupport authenticator = this.authenticationSupport;
if (authenticator != null) {
// SLING-559: ensure correct parameter handling according to
// ParameterSupport
request = ParameterSupport.getParameterSupportRequestWrapper(request);
final boolean result = authenticator.handleSecurity(request, response);
t.logTimer(timerName, "authenticator {0} returns {1}", authenticator, result);
return result;
}
log.error("handleSecurity: AuthenticationSupport service missing. Cannot authenticate request.");
log.error("handleSecurity: Possible reason is missing Repository service. Check AuthenticationSupport dependencies.");
// send 503/SERVICE UNAVAILABLE, flush to ensure delivery
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "AuthenticationSupport service missing. Cannot authenticate request.");
response.flushBuffer();
// terminate this request now
return false;
}
Aggregations