Exemplo n.º 1
0
 public Optional<User> authenticate(BasicCredentials basicCredentials)
     throws AuthenticationException {
   if (basicCredentials.getPassword().equalsIgnoreCase("pwd")) {
     return Optional.of(new User("test user"));
   }
   return Optional.absent();
 }
 @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();
 }