001
014
015 package com.liferay.portal.security.pwd;
016
017 import com.liferay.portal.PwdEncryptorException;
018 import com.liferay.portal.kernel.util.Validator;
019
020
023 public abstract class BasePasswordEncryptor implements PasswordEncryptor {
024
025 public String encrypt(
026 String algorithm, String plainTextPassword,
027 String encryptedPassword)
028 throws PwdEncryptorException {
029
030 if (Validator.isNull(plainTextPassword)) {
031 throw new PwdEncryptorException("Unable to encrypt blank password");
032 }
033
034 return doEncrypt(algorithm, plainTextPassword, encryptedPassword);
035
036 }
037
038 protected abstract String doEncrypt(
039 String algorithm, String plainTextPassword,
040 String encryptedPassword)
041 throws PwdEncryptorException;
042
043 }