Package org.mortbay.jetty.security

Examples of org.mortbay.jetty.security.HashUserRealm


        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint( constraint );
        cm.setPathSpec( "/*" );

        TestSecurityHandler sh = new TestSecurityHandler();
        HashUserRealm hashUserRealm = new HashUserRealm( "MyRealm" );
        hashUserRealm.put( "user", "secret" );
        hashUserRealm.addUserToRole( "user", "admin" );
        sh.setUserRealm( hashUserRealm );
        sh.setConstraintMappings( new ConstraintMapping[]{ cm } );
        return sh;
    }
View Full Code Here


        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint( constraint );
        cm.setPathSpec( "/*" );

        TestSecurityHandler sh = new TestSecurityHandler();
        HashUserRealm hashUserRealm = new HashUserRealm( "MyRealm" );
        hashUserRealm.put( "user", "secret" );
        hashUserRealm.addUserToRole( "user", "admin" );
        sh.setUserRealm( hashUserRealm );
        sh.setConstraintMappings( new ConstraintMapping[]{ cm } );
        return sh;
    }
View Full Code Here

       
        // TODO add javadoc context to contexts
       
        WebAppContext.addWebApplications(server, "../../webapps", "org/mortbay/jetty/webapp/webdefault.xml", true, false);
       
        HashUserRealm userRealm = new HashUserRealm();
        userRealm.setName("Test Realm");
        userRealm.setConfig("../../etc/realm.properties");
        server.setUserRealms(new UserRealm[]{userRealm});
       
       
        server.start();
        server.join();
View Full Code Here

            ConstraintMapping cm = new ConstraintMapping();
            cm.setConstraint( constraint );
            cm.setPathSpec( "/*" );

            SecurityHandler sh = new SecurityHandler();
            sh.setUserRealm( new HashUserRealm( "MyRealm", getBasedir() + "/src/test/resources/realm.properties" ) );
            sh.setConstraintMappings( new ConstraintMapping[] { cm } );

            webapp.addHandler( sh );
        }

View Full Code Here

            ConstraintMapping cm = new ConstraintMapping();
            cm.setConstraint( constraint );
            cm.setPathSpec( "/*" );

            SecurityHandler sh = new SecurityHandler();
            sh.setUserRealm( new HashUserRealm( "MyRealm", getBasedir() + "/src/test/resources/realm.properties" ) );
            sh.setConstraintMappings( new ConstraintMapping[] { cm } );

            webapp.addHandler( sh );
        }

View Full Code Here

    // configure embedded jetty web application handler
    server.addHandler(context);

    // configure embedded jetty authentication realm
    HashUserRealm authedRealm = new HashUserRealm("Authentication Required","etc/jetty-realm.properties");
    server.setUserRealms(new UserRealm[]{authedRealm});

    logger.info("Configured Jetty server");
  }
View Full Code Here

            ConstraintMapping cm = new ConstraintMapping();
            cm.setConstraint(constraint);
            cm.setPathSpec("/*");

            SecurityHandler sh = new SecurityHandler();
            sh.setUserRealm(new HashUserRealm("MyRealm", getClass().getResource("/TestEndpointProperties/jetty-realm.properties").toURI().toString()));
            sh.setConstraintMappings(new ConstraintMapping[]{cm});

            securedEchoContext = new ContextHandler();
            securedEchoContext.setContextPath("/EchoService");

View Full Code Here

        deployer1.setExtract(true);
        deployer1.setAllowDuplicates(false);
        deployer1.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
        server.addLifeCycle(deployer1);
         
        HashUserRealm userRealm = new HashUserRealm();
        userRealm.setName("Test Realm");
        userRealm.setConfig(jetty_home+"/etc/realm.properties");
        server.setUserRealms(new UserRealm[]{userRealm});
       
        NCSARequestLog requestLog = new NCSARequestLog(jetty_home+"/logs/jetty-yyyy_mm_dd.log");
        requestLog.setExtended(false);
        requestLogHandler.setRequestLog(requestLog);
View Full Code Here

        server.setHandler(handlers);
       
        test0 = new WebAppContext(contexts,"../../webapps/test","/test0");
        test1 = new WebAppContext(contexts,"../../webapps/test","/test1");

        HashUserRealm userRealm = new HashUserRealm();
        userRealm.setName("Test Realm");
        userRealm.setConfig("../../etc/realm.properties");
        server.setUserRealms(new UserRealm[]{userRealm});
       
        server.start();
       
        url="http://127.0.0.1:"+server.getConnectors()[0].getLocalPort();
View Full Code Here

        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/admin/*");

        HashUserRealm hashRealm = new HashUserRealm();
        hashRealm.put("jsmith", "password");
        hashRealm.addUserToRole("jsmith", "admin");

        SecurityHandler sh = new SecurityHandler();
        sh.setUserRealm(hashRealm);
        sh.setConstraintMappings(new ConstraintMapping[]{cm});
       
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.security.HashUserRealm

Copyright © 2018 www.massapicom. 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.