Package org.mortbay.http

Examples of org.mortbay.http.SecurityConstraint


       
        context.addHandler(staticContentHandler);
    }

    private void addSecurityHandler(HttpContext context) {
        SecurityConstraint constraint = new SecurityConstraint();
        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");
View Full Code Here


        HttpContext context = new HttpContext();
        context.setContextPath("/selenium-server");
        context.setMimeMapping("xhtml", "application/xhtml+xml");
       
        SecurityConstraint constraint = new SecurityConstraint();
        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");
View Full Code Here

            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() );
        }

        Iterator itpaths = wdc.getServlets().iterator();
        while ( itpaths.hasNext() )
View Full Code Here

       
        context.addHandler(staticContentHandler);
    }

    private void addSecurityHandler(HttpContext context) {
        SecurityConstraint constraint = new SecurityConstraint();
        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");
View Full Code Here

       
        context.addHandler(staticContentHandler);
    }

    private void addSecurityHandler(HttpContext context) {
        SecurityConstraint constraint = new SecurityConstraint();
        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");
View Full Code Here

            for (int m = 0; m < scss.size(); m++) {
                Map.Entry entry = (Map.Entry) scss.get(m);
                Object scs = entry.getValue();
                String p = (String) entry.getKey();
                for (int c = 0; c < LazyList.size(scs); c++) {
                    SecurityConstraint sc = (SecurityConstraint) LazyList.get(scs, c);
                    if (!sc.forMethod(request.getMethod())) continue;

                    if (pattern != null && !pattern.equals(p)) break loop;
                    pattern = p;

                    // Check the method applies
                    if (!sc.forMethod(request.getMethod())) continue;

                    // Combine auth constraints.
                    if (sc.getAuthenticate()) {
                        if (!sc.isAnyRole()) {
                            List scr = sc.getRoles();
                            if (scr == null || scr.size() == 0) {
                                forbidden = true;
                                break loop;
                            }
                        }
View Full Code Here

            context.setAuthenticator(ba);   
           
            SecurityHandler sh =  new SecurityHandler();         
            context.addHandler(sh);

            SecurityConstraint sc = new SecurityConstraint();
            sc.setName("test");
            sc.addRole("*");
            sc.setAuthenticate(true);   
            context.addSecurityConstraint("/", sc);     
           
            ServletHandler servlets = createServletHandler();
            context.addHandler(servlets);
           
View Full Code Here

            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() );
        }

        Iterator itpaths = wdc.getServlets().iterator();
        while ( itpaths.hasNext() )
View Full Code Here

            for (int m = 0; m < scss.size(); m++) {
                Map.Entry entry = (Map.Entry) scss.get(m);
                Object scs = entry.getValue();
                String p = (String) entry.getKey();
                for (int c = 0; c < LazyList.size(scs); c++) {
                    SecurityConstraint sc = (SecurityConstraint) LazyList.get(scs, c);
                    if (!sc.forMethod(request.getMethod())) continue;

                    if (pattern != null && !pattern.equals(p)) break loop;
                    pattern = p;

                    // Check the method applies
                    if (!sc.forMethod(request.getMethod())) continue;

                    // Combine auth constraints.
                    if (sc.getAuthenticate()) {
                        if (!sc.isAnyRole()) {
                            List scr = sc.getRoles();
                            if (scr == null || scr.size() == 0) {
                                forbidden = true;
                                break loop;
                            }
                        }
View Full Code Here

            context.setAuthenticator(ba);   
           
            SecurityHandler sh =  new SecurityHandler();         
            context.addHandler(sh);

            SecurityConstraint sc = new SecurityConstraint();
            sc.setName("test");
            sc.addRole("*");
            sc.setAuthenticate(true);   
            context.addSecurityConstraint("/", sc);     
           
            ServletHandler servlets = createServletHandler();
            context.addHandler(servlets);
           
View Full Code Here

TOP

Related Classes of org.mortbay.http.SecurityConstraint

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.