示例#1
0
        public async Task Can_get_delegation_token()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // First get the access token
            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId    = GetVariable("AUTH0_CLIENT_ID"),
                Connection  = "google-oauth2",
                AccessToken = accessToken,
                Scope       = "openid"
            });

            // Then request the delegation token
            var delegationToken = await authenticationApiClient.GetDelegationTokenAsync(new IdTokenDelegationRequest(
                                                                                            GetVariable("AUTH0_CLIENT_ID"),
                                                                                            GetVariable("AUTH0_CLIENT_ID"),
                                                                                            token.IdToken)
            {
                Scope     = "openid",
                GrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer",
                ApiType   = "app"
            });

            delegationToken.Should().NotBeNull();
            delegationToken.IdToken.Should().NotBeNull();
        }
示例#2
0
        public async Task Can_get_delegation_token()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));
            
            // First get the access token
            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId = GetVariable("AUTH0_CLIENT_ID"),
                Connection = "google-oauth2",
                AccessToken = accessToken,
                Scope = "openid"
            });

            // Then request the delegation token
            var delegationToken = await authenticationApiClient.GetDelegationTokenAsync(new IdTokenDelegationRequest(
                GetVariable("AUTH0_CLIENT_ID"),
                GetVariable("AUTH0_CLIENT_ID"),
                token.IdToken)
            {
                Scope = "openid",
                GrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer",
                ApiType = "app"
            });

            delegationToken.Should().NotBeNull();
            delegationToken.IdToken.Should().NotBeNull();
        }
示例#3
0
        public async Task Can_log_in_with_access_token()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId    = GetVariable("AUTH0_CLIENT_ID"),
                Connection  = "google-oauth2",
                AccessToken = accessToken,
                Scope       = "openid"
            });

            token.Should().NotBeNull();
            token.IdToken.Should().NotBeNull();
            token.AccessToken.Should().NotBeNull();
        }
示例#4
0
        public async Task Can_log_in_with_access_token()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId = GetVariable("AUTH0_CLIENT_ID"),
                Connection = "google-oauth2",
                AccessToken = accessToken,
                Scope = "openid"
            });

            token.Should().NotBeNull();
            token.IdToken.Should().NotBeNull();
            token.AccessToken.Should().NotBeNull();
        }
示例#5
0
        public async Task Can_obtain_user_info()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // First get the access token
            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId = GetVariable("AUTH0_CLIENT_ID"),
                Connection = "google-oauth2",
                AccessToken = accessToken,
                Scope = "openid"
            });


            // Get the user info
            var user = await authenticationApiClient.GetUserInfoAsync(token.AccessToken);
            user.Should().NotBeNull();
            user.Email.Should().NotBeNull();
        }
示例#6
0
        public async Task Can_obtain_token_info()
        {
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // First get the access token
            var token = await authenticationApiClient.GetAccessTokenAsync(new AccessTokenRequest
            {
                ClientId    = GetVariable("AUTH0_CLIENT_ID"),
                Connection  = "google-oauth2",
                AccessToken = accessToken,
                Scope       = "openid"
            });


            // Get the user info
            var user = await authenticationApiClient.GetTokenInfoAsync(token.IdToken);

            user.Should().NotBeNull();
            user.Email.Should().NotBeNull();
        }