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