}
private void checkPassword(Authorizable authorizable, String oldPassword)
throws RepositoryException {
Credentials oldCreds = ((User) authorizable).getCredentials();
if (oldCreds instanceof SimpleCredentials) {
char[] oldCredsPwd = ((SimpleCredentials) oldCreds).getPassword();
if (oldPassword.equals(String.valueOf(oldCredsPwd))) {
return;
}
} else {
try {
// CryptSimpleCredentials.matches(SimpleCredentials credentials)
Class<?> oldCredsClass = oldCreds.getClass();
Method matcher = oldCredsClass.getMethod("matches",
SimpleCredentials.class);
SimpleCredentials newCreds = new SimpleCredentials(
authorizable.getPrincipal().getName(),
oldPassword.toCharArray());