My web application is secured with salted, digested passwords using container managed authentication. I'd like to reduce the coupling with my current container by having a service in JNDI that handles the password mutation / verification. I was after something like this:
/**
* A service for mutating passwords with salt.
* Note that the same password should yield different mutations every time.
*/
public interface PasswordMutationService {
/**
* Mutates the given password for storage purposes.
* The 'salt' must be coded into the result so that it can be extracted later.
*/
String mutatePassword(String password);
/**
* Confirm the given password was used to create the given stored mutation.
*
* @param candidatePassword The password supplied by a user that wants to be authenticated.
* @param storedMutatedPassword A mutation of the users password retrieved from storage.
*/
boolean verifyMutatedPassword(String candidatePassword, String storedMutatedPassword);
}
Do you know of an API that supplies this interface so I don't have to write and manage my own? I have a hard time believing it's not in Java EE somewhere.
NOTE: I'm not after a Tomcat Realm, that has already been done. Nor do I need the implementation, that is done too.