}
}
}
public boolean checkPassword(String plain, String encrypted) {
Encryption encryption = encryptionSupport.getEncryption();
String encryptionPrefix = encryptionSupport.getEncryptionPrefix();
String encryptionSuffix = encryptionSupport.getEncryptionSuffix();
if (encryption == null) {
return plain.equals(encrypted);
} else {
boolean prefix = encryptionPrefix == null || encrypted.startsWith(encryptionPrefix);
boolean suffix = encryptionSuffix == null || encrypted.endsWith(encryptionSuffix);
if (prefix && suffix) {
encrypted = encrypted.substring(encryptionPrefix != null ? encryptionPrefix.length() : 0, encrypted.length()
- (encryptionSuffix != null ? encryptionSuffix.length() : 0));
return encryption.checkPassword(plain, encrypted);
} else {
return plain.equals(encrypted);
}
}
}