ServletHolder servlet = new ServletHolder(new XFireServlet());
context.addServlet(servlet, "/*");
SecurityHandler sh = new SecurityHandler();
context.addHandler(sh);
HashUserRealm userRealm = new HashUserRealm();
userRealm.put("user", "pass");
userRealm.addUserToRole("user", "role");
assertNotNull(userRealm.authenticate("user", "pass", null));
sh.setUserRealm(userRealm);
Constraint constraint = new Constraint();
constraint.setName(Constraint.__BASIC_AUTH);;
constraint.setRoles(new String[]{"role"});
constraint.setAuthenticate(true);