Examples of HashLoginService


Examples of org.eclipse.jetty.security.HashLoginService

        // one. The name of the LoginService needs to correspond to what is
        // configured in the webapp's web.xml and since it has a lifecycle of
        // its own we register it as a bean with the Jetty server object so it
        // can be started and stopped according to the lifecycle of the server
        // itself.
        HashLoginService loginService = new HashLoginService();
        loginService.setName( "Test Realm" );
        loginService.setConfig( "src/test/resources/realm.properties" );
        server.addBean( loginService );

        // Start things up!
        server.start();
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

        // one. The name of the LoginService needs to correspond to what is
        // configured in the webapp's web.xml and since it has a lifecycle of
        // its own we register it as a bean with the Jetty server object so it
        // can be started and stopped according to the lifecycle of the server
        // itself.
        HashLoginService loginService = new HashLoginService();
        loginService.setName("Test Realm");
        loginService.setConfig("src/test/resources/realm.properties");
        server.addBean(loginService);

        // Start things up!
        server.start();
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

    public static void startServer() throws Exception
    {
        server = new Server(0);

        // Configure LoginService
        HashLoginService login = new HashLoginService();
        login.setName("Test Realm");
        File realmFile = MavenTestingUtils.getTestResourceFile("realm.properties");
        login.setConfig(realmFile.getAbsolutePath());
        server.addBean(login);

        // Configure WebApp
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

    public static void startServer() throws Exception
    {
        server = new Server(0)

        // Configure LoginService
        HashLoginService login = new HashLoginService();
        login.setName("Test Realm");
        File realmFile = MavenTestingUtils.getTestResourceFile("realm.properties");
        login.setConfig(realmFile.getAbsolutePath());
        server.addBean(login);

        // Configure WebApp
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

        }
        return context;
    }

    private SecurityHandler getSecurityHandler(String pUser, String pPassword, String pRole) {
      HashLoginService loginService = getLoginService(pUser, pPassword, pRole);
      server.addBean(loginService);         
      ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
      securityHandler.setConstraintMappings(getConstraintMappings(pRole));
      securityHandler.setAuthenticator(new BasicAuthenticator());
      securityHandler.addBean(loginService);
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

        return securityHandler;
    }

    private HashLoginService getLoginService(String pUser, String pPassword, String pRole) {
      Credential credential = Credential.getCredential(pPassword);
      HashLoginService loginService = new HashLoginService("jolokia Realm");
      loginService.putUser(pUser, credential, new String[] {pRole});
      return loginService;
    }
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

    int port = injector.getInstance(Key.get(Integer.class, Names.named("eventhubhandler.port")));

    final Server server = new Server(port);
    @SuppressWarnings("ConstantConditions")
    String webDir = EventHubHandler.class.getClassLoader().getResource("frontend").toExternalForm();
    HashLoginService loginService = new HashLoginService();
    loginService.putUser(properties.getProperty("eventhubhandler.username"),
        new Password(properties.getProperty("eventhubhandler.password")), new String[]{"user"});

    server.addBean(loginService);

    ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

    ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
    securityHandler.setRealmName("Test Server");
    securityHandler.setAuthMethod("BASIC");
    securityHandler.setStrict(true);
    securityHandler.setConstraintMappings(new ConstraintMapping[]{cm});
    HashLoginService hashLoginService = new HashLoginService("Test Server");
    securityHandler.setLoginService(hashLoginService);
    webappContext.setSecurityHandler(securityHandler);

    hashLoginService.putUser("admin", new Password("admin"), new String[]{"users"});

    server.start();

    // ping nexus to wake up
    startNx();
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

        this.publishAddress = publishAddress;
    }

    private static final SecurityHandler basicAuth(String username, String password, String realm) {

        HashLoginService l = new HashLoginService();
        l.putUser(username, Credential.getCredential(password), new String[] {"user"});
        l.setName(realm);

        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);
        constraint.setRoles(new String[]{"user"});
        constraint.setAuthenticate(true);
View Full Code Here

Examples of org.eclipse.jetty.security.HashLoginService

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    alfrescoServer.setHandler(contexts);

    WebAppContext alfrescoServerApi = new WebAppContext(alfrescoServerWarPath,"/alfresco");
    alfrescoServerApi.setParentLoaderPriority(false);
    HashLoginService dummyLoginService = new HashLoginService("TEST-SECURITY-REALM");
    alfrescoServerApi.getSecurityHandler().setLoginService(dummyLoginService);
    contexts.addHandler(alfrescoServerApi);
   
    Class h2DataSource = Thread.currentThread().getContextClassLoader().loadClass("org.h2.jdbcx.JdbcDataSource");
    Object o = h2DataSource.newInstance();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.