@Test public void correctUserNameAndPassword() throws Exception { Optional<UserConfiguration> authenticate = basicAuthenticator.authenticate(new BasicCredentials( correctUsr, correctPw )); assertTrue(authenticate.isPresent()); }
@Override public java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials) throws AuthenticationException { if (userConfiguration != null && userConfiguration.getUsername().equals(credentials.getUsername()) && userConfiguration.getPassword().equals(credentials.getPassword())) { return Optional.of(userConfiguration); } LOGGER.warn("Unauthorized access attempt: {}", credentials.toString()); return Optional.empty(); }
BasicAuthenticator implements Authenticator<BasicCredentials, UserConfiguration> { @Override public java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials) throws AuthenticationException { if (userConfiguration != null && userConfiguration.getUsername().equals(credentials.getUsername()) && userConfiguration.getPassword().equals(credentials.getPassword())) { return Optional.of(userConfiguration); } LOGGER.warn("Unauthorized access attempt: {}", credentials.toString()); return Optional.empty(); } }
BasicAuthenticator implements Authenticator<BasicCredentials, UserConfiguration> { @Override public java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials) throws AuthenticationException { if (userConfiguration != null && userConfiguration.getUsername().equals(credentials.getUsername()) && userConfiguration.getPassword().equals(credentials.getPassword())) { return Optional.of(userConfiguration); } LOGGER.warn("Unauthorized access attempt: {}", credentials.toString()); return Optional.empty(); } BasicAuthenticator(UserConfiguration userConfiguration); }
BasicAuthenticator implements Authenticator<BasicCredentials, UserConfiguration> { @Override public java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials) throws AuthenticationException { if (userConfiguration != null && userConfiguration.getUsername().equals(credentials.getUsername()) && userConfiguration.getPassword().equals(credentials.getPassword())) { return Optional.of(userConfiguration); } LOGGER.warn("Unauthorized access attempt: {}", credentials.toString()); return Optional.empty(); } BasicAuthenticator(UserConfiguration userConfiguration); @Override java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials); }
BasicAuthenticator implements Authenticator<BasicCredentials, UserConfiguration> { @Override public java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials) throws AuthenticationException { if (userConfiguration != null && userConfiguration.getUsername().equals(credentials.getUsername()) && userConfiguration.getPassword().equals(credentials.getPassword())) { return Optional.of(userConfiguration); } LOGGER.warn("Unauthorized access attempt: {}", credentials.toString()); return Optional.empty(); } BasicAuthenticator(UserConfiguration userConfiguration); @Override java.util.Optional<UserConfiguration> authenticate(BasicCredentials credentials);  }