Search in sources :

Example 1 with RemoteRepository

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);
}
Also used : RemoteLoginException(org.apache.jackrabbit.oak.remote.RemoteLoginException) RemoteCredentials(org.apache.jackrabbit.oak.remote.RemoteCredentials) RemoteSession(org.apache.jackrabbit.oak.remote.RemoteSession) RemoteRepository(org.apache.jackrabbit.oak.remote.RemoteRepository)

Example 2 with RemoteRepository

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();
}
Also used : ContentRemoteRepository(org.apache.jackrabbit.oak.remote.content.ContentRemoteRepository) RemoteRepository(org.apache.jackrabbit.oak.remote.RemoteRepository) Before(org.junit.Before)

Aggregations

RemoteRepository (org.apache.jackrabbit.oak.remote.RemoteRepository)2 RemoteCredentials (org.apache.jackrabbit.oak.remote.RemoteCredentials)1 RemoteLoginException (org.apache.jackrabbit.oak.remote.RemoteLoginException)1 RemoteSession (org.apache.jackrabbit.oak.remote.RemoteSession)1 ContentRemoteRepository (org.apache.jackrabbit.oak.remote.content.ContentRemoteRepository)1 Before (org.junit.Before)1