Search in sources :

Example 1 with DefaultAuthenticatorFactory

use of org.eclipse.jetty.security.DefaultAuthenticatorFactory in project activemq-artemis by apache.

the class WebServerComponent method createWebAppContext.

protected WebAppContext createWebAppContext(String url, String warFile, Path warDirectory, String virtualHost) {
    WebAppContext webapp = new WebAppContext();
    if (url.startsWith("/")) {
        webapp.setContextPath(url);
    } else {
        webapp.setContextPath("/" + url);
    }
    // add the filters needed for audit logging
    webapp.addFilter(new FilterHolder(JolokiaFilter.class), "/*", EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
    webapp.addFilter(new FilterHolder(AuthenticationFilter.class), "/auth/login/*", EnumSet.of(DispatcherType.REQUEST));
    webapp.setWar(warDirectory.resolve(warFile).toString());
    webapp.setAttribute("org.eclipse.jetty.webapp.basetempdir", temporaryWarDir.toFile().getAbsolutePath());
    // Set the default authenticator factory to avoid NPE due to the following commit:
    // https://github.com/eclipse/jetty.project/commit/7e91d34177a880ecbe70009e8f200d02e3a0c5dd
    webapp.getSecurityHandler().setAuthenticatorFactory(new DefaultAuthenticatorFactory());
    webapp.setVirtualHosts(new String[] { virtualHost });
    return webapp;
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) FilterHolder(org.eclipse.jetty.servlet.FilterHolder) DefaultAuthenticatorFactory(org.eclipse.jetty.security.DefaultAuthenticatorFactory)

Example 2 with DefaultAuthenticatorFactory

use of org.eclipse.jetty.security.DefaultAuthenticatorFactory in project activemq-artemis by apache.

the class RestTestBase method deployWebApp.

public WebAppContext deployWebApp(String contextPath, File warFile) {
    WebAppContext webapp = new WebAppContext();
    if (contextPath.startsWith("/")) {
        webapp.setContextPath(contextPath);
    } else {
        webapp.setContextPath("/" + contextPath);
    }
    webapp.setWar(warFile.getAbsolutePath());
    webapp.getSecurityHandler().setAuthenticatorFactory(new DefaultAuthenticatorFactory());
    handlers.addHandler(webapp);
    return webapp;
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) DefaultAuthenticatorFactory(org.eclipse.jetty.security.DefaultAuthenticatorFactory)

Example 3 with DefaultAuthenticatorFactory

use of org.eclipse.jetty.security.DefaultAuthenticatorFactory in project activemq-artemis by apache.

the class WebServerComponent method deployWar.

private WebAppContext deployWar(String url, String warFile, Path warDirectory, String virtualHost) {
    WebAppContext webapp = new WebAppContext();
    if (url.startsWith("/")) {
        webapp.setContextPath(url);
    } else {
        webapp.setContextPath("/" + url);
    }
    // add the filters needed for audit logging
    webapp.addFilter(new FilterHolder(JolokiaFilter.class), "/*", EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST));
    webapp.addFilter(new FilterHolder(AuthenticationFilter.class), "/auth/login/*", EnumSet.of(DispatcherType.REQUEST));
    webapp.setWar(warDirectory.resolve(warFile).toString());
    webapp.setAttribute("org.eclipse.jetty.webapp.basetempdir", temporaryWarDir.toFile().getAbsolutePath());
    // Set the default authenticator factory to avoid NPE due to the following commit:
    // https://github.com/eclipse/jetty.project/commit/7e91d34177a880ecbe70009e8f200d02e3a0c5dd
    webapp.getSecurityHandler().setAuthenticatorFactory(new DefaultAuthenticatorFactory());
    webapp.setVirtualHosts(new String[] { virtualHost });
    handlers.addHandler(webapp);
    return webapp;
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) FilterHolder(org.eclipse.jetty.servlet.FilterHolder) DefaultAuthenticatorFactory(org.eclipse.jetty.security.DefaultAuthenticatorFactory)

Aggregations

DefaultAuthenticatorFactory (org.eclipse.jetty.security.DefaultAuthenticatorFactory)3 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)3 FilterHolder (org.eclipse.jetty.servlet.FilterHolder)2