public async Task WhenIntrospectingAndTokenDoesNotExistThenResponseShowsInactiveToken() { var tokenClient = new TokenClient( TokenCredentials.FromClientCredentials("client", "client"), _server.Client, new Uri(BaseUrl + WellKnownOpenidConfiguration)); var introspection = await tokenClient.Introspect( IntrospectionRequest.Create("invalid_token", TokenTypes.AccessToken, "pat")) .ConfigureAwait(false) as Option <OauthIntrospectionResponse> .Result; Assert.False(introspection.Item.Active); }
public async Task When_Introspecting_AccessToken_Then_Information_Are_Returned() { var tokenClient = new TokenClient( TokenCredentials.FromClientCredentials("client", "client"), _server.Client, new Uri(BaseUrl + WellKnownOpenidConfiguration)); var result = await tokenClient.GetToken(TokenRequest.FromPassword("administrator", "password", new[] { "scim" })) .ConfigureAwait(false) as Option <GrantedTokenResponse> .Result; var introspection = await tokenClient.Introspect( IntrospectionRequest.Create(result.Item.AccessToken, TokenTypes.AccessToken, "pat")) .ConfigureAwait(false) as Option <OauthIntrospectionResponse> .Result; Assert.Single(introspection.Item.Scope); Assert.Equal("scim", introspection.Item.Scope.First()); }