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

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