return ctx;
}
- private void auth(ServletContextHandler ctx, Authenticator authType) {
- final String role = "can-access";
+ static class TestMappedLoginService extends MappedLoginService {
+ private String role;
- MappedLoginService users = new MappedLoginService() {
- @Override
- protected UserIdentity loadUser(String who) {
- return null;
- }
+ TestMappedLoginService(String role) {
+ this.role = role;
+ }
- @Override
- protected void loadUsers() throws IOException {
- putUser(username, new Password(password), new String[] { role });
- }
+ @Override
+ protected UserIdentity loadUser(String who) {
+ return null;
+ }
- protected String[] loadRoleInfo(KnownUser user) {
- return null;
- }
+ @Override
+ protected void loadUsers() throws IOException {
+ putUser(username, new Password(password), new String[] { role });
+ }
- protected KnownUser loadUserInfo(String usrname) {
- return null;
- }
- };
+ protected String[] loadRoleInfo(
+ @SuppressWarnings("unused") KnownUser user) {
+ return null;
+ }
+
+ protected KnownUser loadUserInfo(
+ @SuppressWarnings("unused") String usrname) {
+ return null;
+ }
+ }
+
+ private void auth(ServletContextHandler ctx, Authenticator authType) {
+ final String role = "can-access";
+ MappedLoginService users = new TestMappedLoginService(role);
ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(new Constraint());
cm.getConstraint().setAuthenticate(true);