Package org.mortbay.jetty.security

Examples of org.mortbay.jetty.security.ConstraintMapping


        constraint.setName(Constraint.__BASIC_AUTH);;
        constraint.setRoles(new String[]{"role"});
        constraint.setAuthenticate(true);
       
       
        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");
       
        context.setAttribute(XFireServlet.XFIRE_INSTANCE, getXFire());
       
        httpServer.start();
       
View Full Code Here


        constraint.setName( Constraint.__BASIC_AUTH );

        constraint.setRoles( new String[]{ "allowed" } );
        constraint.setAuthenticate( true );

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

        securityHandler = new SecurityHandler();

        securityRealm = new HashUserRealm( "Test Server" );

View Full Code Here

   */
  public static void enforceConstraints(Context ctx) {
    Constraint c = new Constraint();
    c.setAuthenticate(true);

    ConstraintMapping cmt = new ConstraintMapping();
    cmt.setConstraint(c);
    cmt.setMethod("TRACE");
    cmt.setPathSpec("/*");

    ConstraintMapping cmo = new ConstraintMapping();
    cmo.setConstraint(c);
    cmo.setMethod("OPTIONS");
    cmo.setPathSpec("/*");

    SecurityHandler sh = new SecurityHandler();
    sh.setConstraintMappings(new ConstraintMapping[]{cmt, cmo});
    ctx.addHandler(sh);
  }
View Full Code Here

        constraint.setName( Constraint.__BASIC_AUTH );

        constraint.setRoles( new String[]{ "allowed" } );
        constraint.setAuthenticate( true );

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

        SecurityHandler sh = new SecurityHandler();

        HashUserRealm realm = new HashUserRealm( "POC Server" );
        realm.put( "user", "password" );
View Full Code Here

        mapping.setServletName("jbiServlet");
        mapping.setPathSpec("/*");
        handler.setServletMappings(new ServletMapping[] {mapping});
        if (processor.getAuthMethod() != null) {
            SecurityHandler secHandler = new SecurityHandler();
            ConstraintMapping constraintMapping = new ConstraintMapping();
            Constraint constraint = new Constraint();
            constraint.setAuthenticate(true);
            constraint.setRoles(new String[] {"*"});
            constraintMapping.setConstraint(constraint);
            constraintMapping.setPathSpec("/");
            secHandler.setConstraintMappings(new ConstraintMapping[] {constraintMapping});
            secHandler.setHandler(handler);
            secHandler.setAuthMethod(processor.getAuthMethod());
            JaasUserRealm realm = new JaasUserRealm();
            if (configuration.getAuthenticationService() != null) {
View Full Code Here

         Constraint constraint = new Constraint();
         constraint.setName("Need User or Admin");
         constraint.setRoles(new String[]{"user", "admin"});
         constraint.setAuthenticate(true);

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

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

            security.setAuthenticator(new DigestAuthenticator());
            security.setUserRealm(realm);
          
            Constraint constraint = new Constraint("SecureTest","test");
            constraint.setAuthenticate(true);
            ConstraintMapping mapping = new ConstraintMapping();
            mapping.setConstraint(constraint);
            mapping.setPathSpec("/*");
            security.setConstraintMappings(new ConstraintMapping[]{mapping});
           
            HandlerCollection handlers = new HandlerCollection();
            handlers.setHandlers(new Handler[]
            { context, new DefaultHandler() });
View Full Code Here

        constraint.setName("Need User or Admin");
        constraint.setRoles(new String[]
        { "user", "admin" });
        constraint.setAuthenticate(true);

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

        SecurityHandler sh = new SecurityHandler();
        _server.setHandler(sh);
        sh.setUserRealm(userRealm);
        sh.setConstraintMappings(new ConstraintMapping[]
View Full Code Here

                    if (iter3.hasNext())
                    {
                        while (iter3.hasNext())
                        {
                            String method=((XmlParser.Node) iter3.next()).toString(false, true);
                            ConstraintMapping mapping = new ConstraintMapping();
                            mapping.setMethod(method);
                            mapping.setPathSpec(url);
                            mapping.setConstraint(sc);
                            _constraintMappings=LazyList.add(_constraintMappings,mapping);
                        }
                    }
                    else
                    {
                        ConstraintMapping mapping = new ConstraintMapping();
                        mapping.setPathSpec(url);
                        mapping.setConstraint(sc);
                        _constraintMappings=LazyList.add(_constraintMappings,mapping);
                    }
                }
            }
        }
View Full Code Here

        Constraint constraint = new Constraint();
        constraint.setName( Constraint.__BASIC_AUTH );
        constraint.setRoles( new String[]{ "admin" } );
        constraint.setAuthenticate( true );

        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" );
View Full Code Here

TOP

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

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.