use of org.apache.jackrabbit.oak.remote.RemoteRepository 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);
}
use of org.apache.jackrabbit.oak.remote.RemoteRepository in project jackrabbit-oak by apache.
the class RemoteServerIT method setUp.
@Before
public void setUp() throws Exception {
port = getRandomPort();
contentRepository = getContentRepository();
contentSession = getContentSession(contentRepository);
RemoteRepository remoteRepository = getRemoteRepository(contentRepository);
remoteServer = getRemoteServer(remoteRepository, "localhost", port);
remoteServer.start();
}
Aggregations