use of org.apache.sling.auth.core.AuthenticationSupport 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;
}
use of org.apache.sling.auth.core.AuthenticationSupport in project sling by apache.
the class AuthHttpContext 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.
*/
public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
final AuthenticationSupport localAuthenticator = this.authenticator;
if (localAuthenticator != null) {
final String wsp = getWorkspace(request.getPathInfo());
if (wsp != null) {
request.setAttribute("j_workspace", wsp);
}
return localAuthenticator.handleSecurity(request, response);
}
// send 503/SERVICE UNAVAILABLE, flush to ensure delivery
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
response.flushBuffer();
// terminate this request now
return false;
}
Aggregations