Exemple #1
0
        public override AuthenticationInfo Authenticate(AuthToken authToken)
        {
            GetAuthenticationInfoCallCount.incrementAndGet();

            string principal = authToken.Principal();

            char[] credentials = authToken.Credentials();

            if (principal.Equals("neo4j") && Arrays.Equals(credentials, "neo4j".ToCharArray()))
            {
                return(CustomCacheableAuthenticationInfo.of("neo4j", token =>
                {
                    char[] tokenCredentials = token.credentials();
                    return tokenCredentials.SequenceEqual("neo4j".ToCharArray());
                }));
            }
            return(null);
        }
Exemple #2
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));
     }
 }