Package org.eclipse.jetty.security

Examples of org.eclipse.jetty.security.ConstraintSecurityHandler


 
  @Before
  public void setUp() throws Exception
  {
    _context = new SipAppContext();
    _context.setSecurityHandler(new ConstraintSecurityHandler());
  }
View Full Code Here


    constraint.setAuthenticate(true);
    constraint.setRoles(new String[]{"user"});
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
    csh.setRealmName("SecureRealm");
    csh.addConstraintMapping(cm);
    HashLoginService loginService = new HashLoginService();
    loginService.putUser("beaker", Credential.getCredential(password),
                         new String[]{"user"});
    csh.setLoginService(loginService);
    return csh;
  }
View Full Code Here

    constraint.setAuthenticate(true);
    constraint.setRoles(new String[]{"user"});
    ConstraintMapping cm = new ConstraintMapping();
    cm.setConstraint(constraint);
    cm.setPathSpec("/*");
    ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
    csh.setAuthenticator(new BasicAuthenticator());
    csh.setRealmName("SecureRealm");
    csh.addConstraintMapping(cm);
    HashLoginService loginService = new HashLoginService();
    loginService.putUser("beaker", Credential.getCredential(password),
                         new String[]{"user"});
    csh.setLoginService(loginService);
    return csh;
  }
View Full Code Here

    // final HashLoginService loginService = new HashLoginService("MyRealm",
    // "META-INF/realm.properties");
    final JPALoginService loginService = new JPALoginService();
    // server.addBean(loginService);

    final ConstraintSecurityHandler security = new ConstraintSecurityHandler();

    final Constraint constraint = new Constraint();
    constraint.setName(Constraint.__FORM_AUTH);
    constraint.setAuthenticate(true);
    constraint.setRoles(RoleType.names());

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

    security.setConstraintMappings(Arrays
        .asList(new ConstraintMapping[] { cm }));
    final FormAuthenticator fa = new FormAuthenticator(
        WebApplication.ControllerResource.LOGIN.path(),
        WebApplication.ControllerResource.ERROR.path(), false);
    security.setAuthenticator(fa);
    // security.setAuthenticator(new DigestAuthenticator());
    security.setLoginService(loginService);

    context.setSecurityHandler(security);
    server.setHandler(context);
  }
View Full Code Here

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

        ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
        sh.setAuthenticator(new BasicAuthenticator());
        sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[] {cm}));

        HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
        sh.setLoginService(loginService);
        sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[]{cm}));

        return sh;
    }
View Full Code Here

               
                JAASLoginService jaasLogin = new JAASLoginService("TME Graph Editor");
                jaasLogin.setLoginModuleName("ldaploginmodule");
                jaasLogin.setIdentityService(identityService);
               
                ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
                securityHandler.setConstraintMappings(new ConstraintMapping[] {
                    cm
                });
                securityHandler.setAuthenticator(new BasicAuthenticator());
                securityHandler.setLoginService(jaasLogin);
                securityHandler.setStrict(false);
               
                handler.setSecurityHandler(securityHandler);
            }
           
            RewriteHandler rewrite = new RewriteHandler();
View Full Code Here

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

        ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
        sh.setAuthenticator(new BasicAuthenticator());
        sh.setConstraintMappings(new ConstraintMapping[] {cm});

        HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
        sh.setLoginService(loginService);
        sh.setConstraintMappings(new ConstraintMapping[]{cm});

        return sh;
    }
View Full Code Here

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

        ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
        sh.setAuthenticator(new BasicAuthenticator());
        sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[] {cm}));
       
        HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
        sh.setLoginService(loginService);
        sh.setConstraintMappings(Arrays.asList(new ConstraintMapping[]{cm}));

        return sh;
    }
View Full Code Here

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

        ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
        sh.setAuthenticator(new BasicAuthenticator());
        sh.setConstraintMappings(new ConstraintMapping[] {cm});

        HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
        sh.setLoginService(loginService);
        sh.setConstraintMappings(new ConstraintMapping[]{cm});

        return sh;
    }
View Full Code Here

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

        ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
        sh.setAuthenticator(new BasicAuthenticator());
        sh.setConstraintMappings(new ConstraintMapping[] {cm});

        HashLoginService loginService = new HashLoginService("MyRealm", "src/test/resources/myRealm.properties");
        sh.setLoginService(loginService);
        sh.setConstraintMappings(new ConstraintMapping[]{cm});

        return sh;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.security.ConstraintSecurityHandler

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.