setLoginService(findLoginService()); if (_loginService!=null) unmanage(_loginService);
public void configureWebApplication() throws Exception { // Jetty tries to do this in WebAppContext.resolveWebApp but it failed to delete the directory. File t = webApp.getTempDirectory(); if (t==null) t = new File(getProject().getBuild().getDirectory(),"tmp"); File extractedWebAppDir= new File(t, "webapp"); if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) { FileUtils.deleteDirectory(extractedWebAppDir); } super.configureWebApplication(); getWebAppConfig().setWar(webAppFile.getCanonicalPath()); for (Artifact a : (Set<Artifact>) project.getArtifacts()) { if (a.getGroupId().equals("org.jenkins-ci.main") && a.getArtifactId().equals("jenkins-core")) { File coreBasedir = pluginWorkspaceMap.read(a.getId()); if (coreBasedir != null) { String extraCP = new File(coreBasedir, "src/main/resources").toURI() + "," + new File(coreBasedir, "target/classes").toURI(); getLog().info("Will load directly from " + extraCP); getWebAppConfig().setExtraClasspath(extraCP); } } } // cf. https://wiki.jenkins-ci.org/display/JENKINS/Jetty HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm")); hashLoginService.setConfig(System.getProperty("jetty.home", "work") + "/etc/realm.properties"); getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService); }
/** * Sets up Jetty without any actual TCP port serving HTTP. */ @Override protected ServletContext createWebServer() throws Exception { QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10); server = new Server(queuedThreadPool); WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath); context.setClassLoader(getClass().getClassLoader()); context.setConfigurations(new Configuration[]{new WebXmlConfiguration()}); context.addBean(new NoListenerConfiguration(context)); server.setHandler(context); context.getSecurityHandler().setLoginService(configureUserRealm()); context.setResourceBase(bootstrap.warDir.getPath()); server.start(); localPort = -1; setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir)); return context.getServletContext(); }
server.setHandler(context); context.setMimeTypes(MIME_TYPES); context.getSecurityHandler().setLoginService(configureUserRealm()); context.setResourceBase(WarExploder.getExplodedDir().getPath());
/** * Sets up Jetty without any actual TCP port serving HTTP. */ @Override protected ServletContext createWebServer() throws Exception { QueuedThreadPool queuedThreadPool = new QueuedThreadPool(10); server = new Server(queuedThreadPool); WebAppContext context = new WebAppContext(bootstrap.warDir.getPath(), contextPath); context.setClassLoader(getClass().getClassLoader()); context.setConfigurations(new Configuration[]{new WebXmlConfiguration()}); context.addBean(new NoListenerConfiguration(context)); server.setHandler(context); context.getSecurityHandler().setLoginService(configureUserRealm()); context.setResourceBase(bootstrap.warDir.getPath()); server.start(); localPort = -1; setPluginManager(new PluginManagerImpl(context.getServletContext(), bootstrap.pluginsDir)); return context.getServletContext(); }
server.setHandler(context); context.setMimeTypes(MIME_TYPES); context.getSecurityHandler().setLoginService(configureUserRealm());
wac.getSecurityHandler().setLoginService(loginService); wac.setThrowUnavailableOnStartupException(true); // if boot fails, abort the process instead of letting empty Jetty run wac.setMimeTypes(mimeTypes);
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
server.setHandler(context); context.setMimeTypes(MIME_TYPES); context.getSecurityHandler().setLoginService(configureUserRealm()); context.setResourceBase(WarExploder.getExplodedDir().getPath());
server.setHandler(context); context.setMimeTypes(MIME_TYPES); context.getSecurityHandler().setLoginService(configureUserRealm()); context.setResourceBase(WarExploder.getExplodedDir().getPath());
private static Handler getSecuredHandler(final Handler handler, final String login, final String password) { final SecurityHandler securityHandler = new DummySecurityHandler(login); securityHandler.setAuthenticator(new BasicAuthenticator()); securityHandler.setIdentityService(new DefaultIdentityService()); securityHandler.setLoginService(new DummyLoginService(login, password)); securityHandler.setHandler(handler); return securityHandler; }
setLoginService(findLoginService()); if (_loginService!=null) unmanage(_loginService);
setLoginService(findLoginService()); if (_loginService!=null) unmanage(_loginService);
setLoginService(findLoginService()); _discoveredLoginService = true;
setLoginService(findLoginService()); _discoveredLoginService = true;
setLoginService(findLoginService()); if (_loginService!=null) unmanage(_loginService);