* @param credentials Password or other credentials to use in
* authenticating this username
*/
public Principal authenticate(String username, String credentials) {
GenericPrincipal principal =
(GenericPrincipal) principals.get(username);
boolean validated = false;
if (principal != null && credentials != null) {
if (hasMessageDigest()) {
// Hex hashes should be compared case-insensitive
validated = (digest(credentials)
.equalsIgnoreCase(principal.getPassword()));
} else {
validated =
(digest(credentials).equals(principal.getPassword()));
}
}
if (validated) {
if (log.isDebugEnabled())