@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
String principal = (String)token.getPrincipal();
String credentials = new String((char[])token.getCredentials());
if ("root".equals(principal) && "secret".equals(credentials)) {
return new SimpleAuthenticationInfo(principal, credentials.toCharArray(), getName());
} else if ("john".equals(principal) && "foo".equals(credentials)) {
return new SimpleAuthenticationInfo(principal, credentials.toCharArray(), getName());
}
return null;
}