Example #1
0
 public static PluginAuthenticationInfo CreateCacheable(AuthenticationInfo authenticationInfo, string realmName, SecureHasher secureHasher)
 {
     if (authenticationInfo is CustomCacheableAuthenticationInfo)
     {
         CustomCacheableAuthenticationInfo info = ( CustomCacheableAuthenticationInfo )authenticationInfo;
         return(new PluginAuthenticationInfo(authenticationInfo.Principal(), realmName, info.CredentialsMatcher()));
     }
     else if (authenticationInfo is CacheableAuthenticationInfo)
     {
         sbyte[]    credentials       = (( CacheableAuthenticationInfo )authenticationInfo).credentials();
         SimpleHash hashedCredentials = secureHasher.Hash(credentials);
         return(PluginAuthenticationInfo.Create(authenticationInfo, hashedCredentials, realmName));
     }
     else
     {
         return(PluginAuthenticationInfo.Create(authenticationInfo, realmName));
     }
 }