use of org.apache.jackrabbit.oak.remote.RemoteCredentials in project jackrabbit-oak by apache.
the class AuthenticationWrapperHandler method handle.
@Override
public void handle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RemoteSession session = (RemoteSession) request.getAttribute("session");
if (session != null) {
authenticated.handle(request, response);
return;
}
RemoteRepository repository = (RemoteRepository) request.getAttribute("repository");
if (repository == null) {
sendInternalServerError(response, "repository not found");
return;
}
RemoteCredentials credentials = extractCredentials(request, repository);
if (credentials == null) {
notAuthenticated.handle(request, response);
return;
}
try {
session = repository.login(credentials);
} catch (RemoteLoginException e) {
logger.warn("unable to authenticate to the repository", e);
notAuthenticated.handle(request, response);
return;
}
request.setAttribute("session", session);
authenticated.handle(request, response);
}
Aggregations