public async Task ShouldCreateCustomAuthToken()
        {
            var oldAuthToken = AuthToken.AsDictionary();
            var newAuthToken = AuthTokens.Custom(oldAuthToken["principal"].As <string>(),
                                                 oldAuthToken["credentials"].As <string>(), "native", "basic");

            await VerifyConnectivity(ServerEndPoint, newAuthToken);
        }
        public async Task ShouldProvideRealmWithBasicAuthToken()
        {
            var oldAuthToken = AuthToken.AsDictionary();
            var newAuthToken = AuthTokens.Basic(oldAuthToken["principal"].As <string>(),
                                                oldAuthToken["credentials"].As <string>(), "native");

            await VerifyConnectivity(ServerEndPoint, newAuthToken);
        }
        public async Task ShouldCreateCustomAuthTokenWithAdditionalParameters()
        {
            var oldAuthToken = AuthToken.AsDictionary();
            var newAuthToken = AuthTokens.Custom(
                oldAuthToken["principal"].As <string>(), oldAuthToken["credentials"].As <string>(), "native", "basic",
                new Dictionary <string, object> {
                { "secret", 42 }
            });

            await VerifyConnectivity(ServerEndPoint, newAuthToken);
        }
Exemplo n.º 4
0
        public void ShouldProvideRealmWithBasicAuthToken()
        {
            var oldAuthToken = AuthToken.AsDictionary();
            var newAuthToken = AuthTokens.Basic(oldAuthToken["principal"].ValueAs <string>(),
                                                oldAuthToken["credentials"].ValueAs <string>(), "native");

            using (var driver = GraphDatabase.Driver(ServerEndPoint, newAuthToken))
                using (var session = driver.Session())
                {
                    var result = session.Run("RETURN 2 as Number");
                    result.Consume();
                    result.Keys.Should().Contain("Number");
                    result.Keys.Count.Should().Be(1);
                }
        }
Exemplo n.º 5
0
        public void ShouldCreateCustomAuthTokenWithAdditionalParameters()
        {
            var oldAuthToken = AuthToken.AsDictionary();
            var newAuthToken = AuthTokens.Custom(
                oldAuthToken["principal"].ValueAs <string>(),
                oldAuthToken["credentials"].ValueAs <string>(),
                "native",
                "basic",
                new Dictionary <string, object> {
                { "secret", 42 }
            });

            using (var driver = GraphDatabase.Driver(ServerEndPoint, newAuthToken))
                using (var session = driver.Session())
                {
                    var result = session.Run("RETURN 2 as Number");
                    result.Consume();
                    result.Keys.Should().Contain("Number");
                    result.Keys.Count.Should().Be(1);
                }
        }