validate

Sets a validation function that checks a specified UserPasswordCredential instance and returns Principal in a case of successful authentication or null if authentication fails.