@Override public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException { if ("auth".equals(credentials.getUsername()) && "secret".equals(credentials.getPassword())) { User u = new User(); u.setUsername("auth"); return Optional.of(u); } return Optional.absent(); }
public Optional<User> authenticate(BasicCredentials basicCredentials) throws AuthenticationException { if (basicCredentials.getPassword().equalsIgnoreCase("pwd")) { return Optional.of(new User("test user")); } return Optional.absent(); }