예제 #1
0
 protected internal virtual void AddPasswordCheckerAndThrowErrorIfAlreadyAvailable(IPasswordEncryptor encryptor)
 {
     if (PasswordChecker.ContainsKey(encryptor.HashAlgorithmName()))
     {
         throw Log.HashAlgorithmForPasswordEncryptionAlreadyAvailableException(encryptor.HashAlgorithmName());
     }
     PasswordChecker[encryptor.HashAlgorithmName()] = encryptor;
 }
예제 #2
0
        public virtual string Encrypt(string password)
        {
            var prefix = PrefixHandler.GeneratePrefix(DefaultPasswordEncryptor.HashAlgorithmName());

            return(prefix + DefaultPasswordEncryptor.Encrypt(password));
        }
예제 #3
0
 protected internal virtual void AddDefaultEncryptor(IPasswordEncryptor defaultPasswordEncryptor)
 {
     this.DefaultPasswordEncryptor = defaultPasswordEncryptor;
     PasswordChecker[defaultPasswordEncryptor.HashAlgorithmName()] = defaultPasswordEncryptor;
 }