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