Examples of HashUserRealm


Examples of org.mortbay.http.HashUserRealm

        constraint.addRole("user");
        constraint.setAuthenticate(true);

        context.addSecurityConstraint("/tests/html/basicAuth/*", constraint);
        HashUserRealm realm = new HashUserRealm("MyRealm");
        realm.put("alice", "foo");
        realm.addUserToRole("alice", "user");
        context.setRealm(realm);

        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);
    }
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

        constraint.setName(SecurityConstraint.__BASIC_AUTH);;
        constraint.addRole("user");
        constraint.setAuthenticate(true);

        context.addSecurityConstraint("/tests/html/basicAuth/*", constraint);
        HashUserRealm realm = new HashUserRealm("MyRealm");
        realm.put("alice", "foo");
        realm.addUserToRole("alice", "user");
        context.setRealm(realm);
       
        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);

View Full Code Here

Examples of org.mortbay.http.HashUserRealm

        throws ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        AuthenticationInfo authenticationInfo = wdc.getAuthenticationInfo();
        if ( authenticationInfo != null )
        {
            HashUserRealm userRealm = new HashUserRealm( "basic" );
            userRealm.put( authenticationInfo.getUserName(), authenticationInfo.getPassword() );
            context.getHttpServer().addRealm( userRealm );

            context.setAuthenticator( new BasicAuthenticator() );
            context.addSecurityConstraint( "/*", new SecurityConstraint( "any", SecurityConstraint.ANY_ROLE ) );
            context.addHandler( new SecurityHandler() );
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

        constraint.addRole("user");
        constraint.setAuthenticate(true);

        context.addSecurityConstraint("/tests/html/basicAuth/*", constraint);
        HashUserRealm realm = new HashUserRealm("MyRealm");
        realm.put("alice", "foo");
        realm.addUserToRole("alice", "user");
        context.setRealm(realm);

        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);
    }
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

        constraint.addRole("user");
        constraint.setAuthenticate(true);

        context.addSecurityConstraint("/tests/html/basicAuth/*", constraint);
        HashUserRealm realm = new HashUserRealm("MyRealm");
        realm.put("alice", "foo");
        realm.addUserToRole("alice", "user");
        context.setRealm(realm);

        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);
    }
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

            setupServer();
           
            HttpContext context = createContext();

            URL url = this.getClass().getResource("/testuser.properties");           
            UserRealm ur = new HashUserRealm("test", url.getFile());           
            context.setRealm(ur);

            BasicAuthenticator ba = new BasicAuthenticator();
            context.setAuthenticator(ba);   
           
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

        throws ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        AuthenticationInfo authenticationInfo = wdc.getAuthenticationInfo();
        if ( authenticationInfo != null )
        {
            HashUserRealm userRealm = new HashUserRealm( "basic" );
            userRealm.put( authenticationInfo.getUserName(), authenticationInfo.getPassword() );
            context.getHttpServer().addRealm( userRealm );

            context.setAuthenticator( new BasicAuthenticator() );
            context.addSecurityConstraint( "/*", new SecurityConstraint( "any", SecurityConstraint.ANY_ROLE ) );
            context.addHandler( new SecurityHandler() );
View Full Code Here

Examples of org.mortbay.http.HashUserRealm

            setupServer();
           
            HttpContext context = createContext();

            URL url = this.getClass().getResource("/testuser.properties");           
            UserRealm ur = new HashUserRealm("test", url.getFile());           
            context.setRealm(ur);

            BasicAuthenticator ba = new BasicAuthenticator();
            context.setAuthenticator(ba);   
           
View Full Code Here

Examples of org.mortbay.jetty.security.HashUserRealm

       
        context.addServlet(servlet, "/*");
        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);
       
        HashUserRealm userRealm = new HashUserRealm();
        userRealm.put("user", "pass");
        userRealm.addUserToRole("user", "role");

        assertNotNull(userRealm.authenticate("user", "pass", null));
       
        sh.setUserRealm(userRealm);
       
        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);;
View Full Code Here

Examples of org.mortbay.jetty.security.HashUserRealm

        cm.setConstraint( constraint );
        cm.setPathSpec( "/protected/*" );

        securityHandler = new SecurityHandler();

        securityRealm = new HashUserRealm( "Test Server" );

        securityHandler.setUserRealm( securityRealm );
        securityHandler.setConstraintMappings( new ConstraintMapping[]{ cm } );

        webappContext = new WebAppContext();
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.