@Test public void testValidate_BadPassword() throws Exception { JettyHashUserRealmVerifier verify = new JettyHashUserRealmVerifier(config.getProperty(HttpConsumerTest.JETTY_USER_REALM)); Map<String, Object> identityMap = new HashMap<>(); identityMap.put(JettyHashUserRealmVerifier.KEY_USERNAME, "user"); identityMap.put(JettyHashUserRealmVerifier.KEY_PASSWORD, testName.getMethodName()); try { BaseCase.start(verify); assertFalse(verify.validate(createIdentityBuilderFromMap(identityMap), null)); } finally { BaseCase.stop(verify); } }
@Override public boolean validate(IdentityBuilder builder, AdaptrisMessage msg) { boolean result = false; try { Map<String, Object> identity = builder.build(msg); Map<String, AccessCredentials> myUsers = loadUsers(); String username = (String) identity.get(KEY_USERNAME); if (myUsers.containsKey(username)) { result = myUsers.get(username).validate((String) identity.get(KEY_PASSWORD), (String) identity.get(KEY_ROLE)); } } catch (Exception e) { result = false; } return result; }
JettyHashUserRealmVerifier extends IdentityVerifierImpl { @Override public boolean validate(IdentityBuilder builder, AdaptrisMessage msg) { boolean result = false; try { Map<String, Object> identity = builder.build(msg); Map<String, AccessCredentials> myUsers = loadUsers(); String username = (String) identity.get(KEY_USERNAME); if (myUsers.containsKey(username)) { result = myUsers.get(username).validate((String) identity.get(KEY_PASSWORD), (String) identity.get(KEY_ROLE)); } } catch (Exception e) { result = false; } return result; } }
JettyHashUserRealmVerifier extends IdentityVerifierImpl { @Override public boolean validate(IdentityBuilder builder, AdaptrisMessage msg) { boolean result = false; try { Map<String, Object> identity = builder.build(msg); Map<String, AccessCredentials> myUsers = loadUsers(); String username = (String) identity.get(KEY_USERNAME); if (myUsers.containsKey(username)) { result = myUsers.get(username).validate((String) identity.get(KEY_PASSWORD), (String) identity.get(KEY_ROLE)); } } catch (Exception e) { result = false; } return result; } JettyHashUserRealmVerifier();  JettyHashUserRealmVerifier(String filename); }
JettyHashUserRealmVerifier extends IdentityVerifierImpl { @Override public boolean validate(IdentityBuilder builder, AdaptrisMessage msg) { boolean result = false; try { Map<String, Object> identity = builder.build(msg); Map<String, AccessCredentials> myUsers = loadUsers(); String username = (String) identity.get(KEY_USERNAME); if (myUsers.containsKey(username)) { result = myUsers.get(username).validate((String) identity.get(KEY_PASSWORD), (String) identity.get(KEY_ROLE)); } } catch (Exception e) { result = false; } return result; } JettyHashUserRealmVerifier();  JettyHashUserRealmVerifier(String filename); @Override void init(); @Override boolean validate(IdentityBuilder builder, AdaptrisMessage msg); String getFilename(); void setFilename(String filename); }
JettyHashUserRealmVerifier extends IdentityVerifierImpl { @Override public boolean validate(IdentityBuilder builder, AdaptrisMessage msg) { boolean result = false; try { Map<String, Object> identity = builder.build(msg); Map<String, AccessCredentials> myUsers = loadUsers(); String username = (String) identity.get(KEY_USERNAME); if (myUsers.containsKey(username)) { result = myUsers.get(username).validate((String) identity.get(KEY_PASSWORD), (String) identity.get(KEY_ROLE)); } } catch (Exception e) { result = false; } return result; } JettyHashUserRealmVerifier();  JettyHashUserRealmVerifier(String filename); @Override void init(); @Override boolean validate(IdentityBuilder builder, AdaptrisMessage msg); String getFilename(); void setFilename(String filename); static final String KEY_USERNAME; static final String KEY_PASSWORD; static final String KEY_ROLE; }