Exemple #1
0
        public async Task ShouldNotGetTokenForNonExistingClient()
        {
            var httpClient        = HttpClientProvider.CreateClient();
            var discoveryDocument = await HttpClientProvider.GetDiscoveryDocumentAsync();

            var token = await httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest()
            {
                Address      = discoveryDocument.TokenEndpoint,
                ClientId     = "non-existing-client",
                ClientSecret = "non-existing-client-secret"
            });

            token.IsError.Should().BeTrue();
        }
Exemple #2
0
        public async Task ShouldBeAbleToGetTokenForClient()
        {
            var httpClient        = HttpClientProvider.CreateClient();
            var discoveryDocument = await HttpClientProvider.GetDiscoveryDocumentAsync();

            var token = await httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest()
            {
                Address      = discoveryDocument.TokenEndpoint,
                ClientId     = "modular-monolith-client",
                ClientSecret = "modular-monolith-client-secret"
            });

            token.IsError.Should().BeFalse();
            token.AccessToken.Should().NotBeNullOrWhiteSpace();
        }