|
|
@ -31,7 +31,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractConfigurationRequest_UnexpectedMethodReturnsAnError(string method) |
|
|
public async Task ExtractConfigurationRequest_UnexpectedMethodReturnsAnError(string method) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.EnableDegradedMode()); |
|
|
await using var server = await CreateServerAsync(options => options.EnableDegradedMode()); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.SendAsync(method, "/.well-known/openid-configuration", new OpenIddictRequest()); |
|
|
var response = await client.SendAsync(method, "/.well-known/openid-configuration", new OpenIddictRequest()); |
|
|
@ -52,7 +53,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task ExtractConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -65,6 +66,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -78,7 +81,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractConfigurationRequest_AllowsHandlingResponse() |
|
|
public async Task ExtractConfigurationRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -96,6 +99,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -107,7 +112,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractConfigurationRequest_AllowsSkippingHandler() |
|
|
public async Task ExtractConfigurationRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -120,6 +125,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -138,7 +145,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task ValidateConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -151,6 +158,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -164,7 +173,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateConfigurationRequest_AllowsHandlingResponse() |
|
|
public async Task ValidateConfigurationRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -182,6 +191,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -193,7 +204,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateConfigurationRequest_AllowsSkippingHandler() |
|
|
public async Task ValidateConfigurationRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -206,6 +217,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -217,7 +230,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_IssuerIsAutomaticallyInferred() |
|
|
public async Task HandleConfigurationRequest_IssuerIsAutomaticallyInferred() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -231,11 +245,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_RegisteredIssuerIsAlwaysPreferred() |
|
|
public async Task HandleConfigurationRequest_RegisteredIssuerIsAlwaysPreferred() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.SetIssuer(new Uri("https://www.fabrikam.com/")); |
|
|
options.SetIssuer(new Uri("https://www.fabrikam.com/")); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -248,7 +264,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_AbsoluteEndpointsAreCorrectlyExposed() |
|
|
public async Task HandleConfigurationRequest_AbsoluteEndpointsAreCorrectlyExposed() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.SetAuthorizationEndpointUris("https://www.fabrikam.com/path/authorization_endpoint") |
|
|
options.SetAuthorizationEndpointUris("https://www.fabrikam.com/path/authorization_endpoint") |
|
|
.SetCryptographyEndpointUris("https://www.fabrikam.com/path/cryptography_endpoint") |
|
|
.SetCryptographyEndpointUris("https://www.fabrikam.com/path/cryptography_endpoint") |
|
|
@ -260,6 +276,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
.SetUserinfoEndpointUris("https://www.fabrikam.com/path/userinfo_endpoint"); |
|
|
.SetUserinfoEndpointUris("https://www.fabrikam.com/path/userinfo_endpoint"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -340,7 +358,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_RelativeEndpointsAreCorrectlyComputed(string issuer, string[] endpoints) |
|
|
public async Task HandleConfigurationRequest_RelativeEndpointsAreCorrectlyComputed(string issuer, string[] endpoints) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.SetIssuer(new Uri(issuer, UriKind.Absolute)); |
|
|
options.SetIssuer(new Uri(issuer, UriKind.Absolute)); |
|
|
|
|
|
|
|
|
@ -354,6 +372,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
.SetUserinfoEndpointUris(endpoints[7]); |
|
|
.SetUserinfoEndpointUris(endpoints[7]); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -387,13 +407,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenTokenEndpointIsDisabled() |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenTokenEndpointIsDisabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.GrantTypes.Clear()); |
|
|
options.Configure(options => options.GrantTypes.Clear()); |
|
|
options.Configure(options => options.GrantTypes.Add(GrantTypes.Implicit)); |
|
|
options.Configure(options => options.GrantTypes.Add(GrantTypes.Implicit)); |
|
|
options.SetTokenEndpointUris(Array.Empty<Uri>()); |
|
|
options.SetTokenEndpointUris(Array.Empty<Uri>()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -405,7 +427,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenTokenEndpointIsEnabled() |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenTokenEndpointIsEnabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -420,11 +443,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenIntrospectionEndpointIsDisabled() |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenIntrospectionEndpointIsDisabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.SetIntrospectionEndpointUris(Array.Empty<Uri>()); |
|
|
options.SetIntrospectionEndpointUris(Array.Empty<Uri>()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -436,7 +461,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenIntrospectionEndpointIsEnabled() |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenIntrospectionEndpointIsEnabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -451,11 +477,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenRevocationEndpointIsDisabled() |
|
|
public async Task HandleConfigurationRequest_NoClientAuthenticationMethodIsIncludedWhenRevocationEndpointIsDisabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.SetRevocationEndpointUris(Array.Empty<Uri>()); |
|
|
options.SetRevocationEndpointUris(Array.Empty<Uri>()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -467,7 +495,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenRevocationEndpointIsEnabled() |
|
|
public async Task HandleConfigurationRequest_SupportedClientAuthenticationMethodsAreIncludedWhenRevocationEndpointIsEnabled() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -482,13 +511,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredGrantTypesAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredGrantTypesAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.GrantTypes.Clear(); |
|
|
options.GrantTypes.Clear(); |
|
|
options.GrantTypes.Add(GrantTypes.AuthorizationCode); |
|
|
options.GrantTypes.Add(GrantTypes.AuthorizationCode); |
|
|
options.GrantTypes.Add(GrantTypes.Password); |
|
|
options.GrantTypes.Add(GrantTypes.Password); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var types = (string[]) response[Metadata.GrantTypesSupported]; |
|
|
var types = (string[]) response[Metadata.GrantTypesSupported]; |
|
|
@ -503,11 +534,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoSupportedCodeChallengeMethodsPropertyIsReturnedWhenNoMethodIsConfigured() |
|
|
public async Task HandleConfigurationRequest_NoSupportedCodeChallengeMethodsPropertyIsReturnedWhenNoMethodIsConfigured() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.CodeChallengeMethods.Clear()); |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.CodeChallengeMethods.Clear()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -519,13 +552,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredCodeChallengeMethodsAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredCodeChallengeMethodsAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.CodeChallengeMethods.Clear(); |
|
|
options.CodeChallengeMethods.Clear(); |
|
|
options.CodeChallengeMethods.Add(CodeChallengeMethods.Sha256); |
|
|
options.CodeChallengeMethods.Add(CodeChallengeMethods.Sha256); |
|
|
options.CodeChallengeMethods.Add(CodeChallengeMethods.Plain); |
|
|
options.CodeChallengeMethods.Add(CodeChallengeMethods.Plain); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var methods = (string[]) response[Metadata.CodeChallengeMethodsSupported]; |
|
|
var methods = (string[]) response[Metadata.CodeChallengeMethodsSupported]; |
|
|
@ -540,11 +575,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoSupportedResponseModesPropertyIsReturnedWhenNoResponseModeIsConfigured() |
|
|
public async Task HandleConfigurationRequest_NoSupportedResponseModesPropertyIsReturnedWhenNoResponseModeIsConfigured() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.ResponseModes.Clear()); |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.ResponseModes.Clear()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -556,13 +593,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredResponseModesAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredResponseModesAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.ResponseModes.Clear(); |
|
|
options.ResponseModes.Clear(); |
|
|
options.ResponseModes.Add(ResponseModes.FormPost); |
|
|
options.ResponseModes.Add(ResponseModes.FormPost); |
|
|
options.ResponseModes.Add(ResponseModes.Fragment); |
|
|
options.ResponseModes.Add(ResponseModes.Fragment); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var modes = (string[]) response[Metadata.ResponseModesSupported]; |
|
|
var modes = (string[]) response[Metadata.ResponseModesSupported]; |
|
|
@ -577,11 +616,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoSupportedResponseTypesPropertyIsReturnedWhenNoResponseTypeIsConfigured() |
|
|
public async Task HandleConfigurationRequest_NoSupportedResponseTypesPropertyIsReturnedWhenNoResponseTypeIsConfigured() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.ResponseTypes.Clear()); |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.ResponseTypes.Clear()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -593,13 +634,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredResponseTypesAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredResponseTypesAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.ResponseTypes.Clear(); |
|
|
options.ResponseTypes.Clear(); |
|
|
options.ResponseTypes.Add(ResponseTypes.Code); |
|
|
options.ResponseTypes.Add(ResponseTypes.Code); |
|
|
options.ResponseTypes.Add(ResponseTypes.Code + ' ' + ResponseTypes.IdToken); |
|
|
options.ResponseTypes.Add(ResponseTypes.Code + ' ' + ResponseTypes.IdToken); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var types = (string[]) response[Metadata.ResponseTypesSupported]; |
|
|
var types = (string[]) response[Metadata.ResponseTypesSupported]; |
|
|
@ -614,11 +657,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoSupportedScopesPropertyIsReturnedWhenNoScopeIsConfigured() |
|
|
public async Task HandleConfigurationRequest_NoSupportedScopesPropertyIsReturnedWhenNoScopeIsConfigured() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.Scopes.Clear()); |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.Scopes.Clear()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -630,13 +675,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredScopesAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredScopesAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.Scopes.Clear(); |
|
|
options.Scopes.Clear(); |
|
|
options.Scopes.Add(Scopes.OpenId); |
|
|
options.Scopes.Add(Scopes.OpenId); |
|
|
options.Scopes.Add("custom_scope"); |
|
|
options.Scopes.Add("custom_scope"); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var scopes = (string[]) response[Metadata.ScopesSupported]; |
|
|
var scopes = (string[]) response[Metadata.ScopesSupported]; |
|
|
@ -651,11 +698,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_NoSupportedClaimsPropertyIsReturnedWhenNoClaimIsConfigured() |
|
|
public async Task HandleConfigurationRequest_NoSupportedClaimsPropertyIsReturnedWhenNoClaimIsConfigured() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.Claims.Clear()); |
|
|
options.Services.PostConfigure<OpenIddictServerOptions>(options => options.Claims.Clear()); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -667,13 +716,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_ConfiguredClaimsAreReturned() |
|
|
public async Task HandleConfigurationRequest_ConfiguredClaimsAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
await using var server = await CreateServerAsync(options => options.Services.PostConfigure<OpenIddictServerOptions>(options => |
|
|
{ |
|
|
{ |
|
|
options.Claims.Clear(); |
|
|
options.Claims.Clear(); |
|
|
options.Claims.Add(Claims.Profile); |
|
|
options.Claims.Add(Claims.Profile); |
|
|
options.Claims.Add("custom_claim"); |
|
|
options.Claims.Add("custom_claim"); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var claims = (string[]) response[Metadata.ClaimsSupported]; |
|
|
var claims = (string[]) response[Metadata.ClaimsSupported]; |
|
|
@ -688,7 +739,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SupportedSubjectTypesAreCorrectlyReturned() |
|
|
public async Task HandleConfigurationRequest_SupportedSubjectTypesAreCorrectlyReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -712,12 +764,14 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var credentials = new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), algorithm); |
|
|
var credentials = new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), algorithm); |
|
|
|
|
|
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.AddSigningCredentials(credentials); |
|
|
options.AddSigningCredentials(credentials); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
@ -730,13 +784,15 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SymmetricSigningKeysAreIgnored() |
|
|
public async Task HandleConfigurationRequest_SymmetricSigningKeysAreIgnored() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.AddSigningKey(new SymmetricSecurityKey(new byte[256 / 8])); |
|
|
options.AddSigningKey(new SymmetricSecurityKey(new byte[256 / 8])); |
|
|
options.AddSigningCredentials(new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), Algorithms.RsaSha256)); |
|
|
options.AddSigningCredentials(new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), Algorithms.RsaSha256)); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
@ -752,7 +808,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var credentials = new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), SecurityAlgorithms.RsaSha256Signature); |
|
|
var credentials = new SigningCredentials(Mock.Of<AsymmetricSecurityKey>(), SecurityAlgorithms.RsaSha256Signature); |
|
|
|
|
|
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.AddSigningCredentials(credentials); |
|
|
options.AddSigningCredentials(credentials); |
|
|
@ -760,6 +816,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
options.AddSigningCredentials(credentials); |
|
|
options.AddSigningCredentials(credentials); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
var algorithms = (string[]) response[Metadata.IdTokenSigningAlgValuesSupported]; |
|
|
@ -772,7 +830,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_SupportedParametersAreReturned() |
|
|
public async Task HandleConfigurationRequest_SupportedParametersAreReturned() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
@ -794,7 +853,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task HandleConfigurationRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -807,6 +866,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -820,7 +881,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_AllowsHandlingResponse() |
|
|
public async Task HandleConfigurationRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -838,6 +899,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -849,7 +912,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleConfigurationRequest_AllowsSkippingHandler() |
|
|
public async Task HandleConfigurationRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -862,6 +925,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -873,7 +938,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ApplyConfigurationResponse_AllowsHandlingResponse() |
|
|
public async Task ApplyConfigurationResponse_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -891,6 +956,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -902,7 +969,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ApplyConfigurationResponse_ResponseContainsCustomParameters() |
|
|
public async Task ApplyConfigurationResponse_ResponseContainsCustomParameters() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -920,6 +987,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
var response = await client.GetAsync("/.well-known/openid-configuration"); |
|
|
|
|
|
|
|
|
@ -937,7 +1006,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractCryptographyRequest_UnexpectedMethodReturnsAnError(string method) |
|
|
public async Task ExtractCryptographyRequest_UnexpectedMethodReturnsAnError(string method) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.SendAsync(method, "/.well-known/jwks", new OpenIddictRequest()); |
|
|
var response = await client.SendAsync(method, "/.well-known/jwks", new OpenIddictRequest()); |
|
|
@ -958,7 +1028,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task ExtractCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -971,6 +1041,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -984,7 +1056,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractCryptographyRequest_AllowsHandlingResponse() |
|
|
public async Task ExtractCryptographyRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1002,6 +1074,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1013,7 +1087,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ExtractCryptographyRequest_AllowsSkippingHandler() |
|
|
public async Task ExtractCryptographyRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1026,6 +1100,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1044,7 +1120,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task ValidateCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1057,6 +1133,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1070,7 +1148,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateCryptographyRequest_AllowsHandlingResponse() |
|
|
public async Task ValidateCryptographyRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1088,6 +1166,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1099,7 +1179,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ValidateCryptographyRequest_AllowsSkippingHandler() |
|
|
public async Task ValidateCryptographyRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1112,6 +1192,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1134,11 +1216,13 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
var factory = Mock.Of<CryptoProviderFactory>(mock => !mock.IsSupportedAlgorithm(algorithm, It.IsAny<SecurityKey>())); |
|
|
var factory = Mock.Of<CryptoProviderFactory>(mock => !mock.IsSupportedAlgorithm(algorithm, It.IsAny<SecurityKey>())); |
|
|
var key = Mock.Of<SecurityKey>(mock => mock.CryptoProviderFactory == factory); |
|
|
var key = Mock.Of<SecurityKey>(mock => mock.CryptoProviderFactory == factory); |
|
|
|
|
|
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.AddSigningCredentials(new SigningCredentials(key, algorithm)); |
|
|
options.AddSigningCredentials(new SigningCredentials(key, algorithm)); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var keys = (JsonElement) response[Parameters.Keys]; |
|
|
var keys = (JsonElement) response[Parameters.Keys]; |
|
|
@ -1164,12 +1248,14 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
Q = Convert.FromBase64String("vQy5C++AzF+TRh6qwbKzOqt87ZHEHidIAh6ivRNewjzIgCWXpseVl7DimY1YdViOnw1VI7xY+EyiyTanq5caTqqB3KcDm2t40bJfrZuUcn/5puRIh1bKNDwIMLsuNCrjHmDlNbocqpYMOh0Pgw7ARNbqrnPjWsYGJPuMNFpax/U=") |
|
|
Q = Convert.FromBase64String("vQy5C++AzF+TRh6qwbKzOqt87ZHEHidIAh6ivRNewjzIgCWXpseVl7DimY1YdViOnw1VI7xY+EyiyTanq5caTqqB3KcDm2t40bJfrZuUcn/5puRIh1bKNDwIMLsuNCrjHmDlNbocqpYMOh0Pgw7ARNbqrnPjWsYGJPuMNFpax/U=") |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.AddSigningKey(new RsaSecurityKey(parameters)); |
|
|
options.AddSigningKey(new RsaSecurityKey(parameters)); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var key = response[Parameters.Keys]?[0]; |
|
|
var key = response[Parameters.Keys]?[0]; |
|
|
@ -1222,12 +1308,14 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
|
|
|
|
|
|
var algorithm = ECDsa.Create(parameters); |
|
|
var algorithm = ECDsa.Create(parameters); |
|
|
|
|
|
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.Configure(options => options.SigningCredentials.Clear()); |
|
|
options.AddSigningKey(new ECDsaSecurityKey(algorithm)); |
|
|
options.AddSigningKey(new ECDsaSecurityKey(algorithm)); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var key = response[Parameters.Keys]?[0]; |
|
|
var key = response[Parameters.Keys]?[0]; |
|
|
@ -1244,7 +1332,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleCryptographyRequest_X509CertificatesAreCorrectlyExposed() |
|
|
public async Task HandleCryptographyRequest_X509CertificatesAreCorrectlyExposed() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(); |
|
|
await using var server = await CreateServerAsync(); |
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
@ -1266,7 +1355,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
public async Task HandleCryptographyRequest_AllowsRejectingRequest(string error, string description, string uri) |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1279,6 +1368,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1292,7 +1383,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleCryptographyRequest_AllowsHandlingResponse() |
|
|
public async Task HandleCryptographyRequest_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1310,6 +1401,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1321,7 +1414,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task HandleCryptographyRequest_AllowsSkippingHandler() |
|
|
public async Task HandleCryptographyRequest_AllowsSkippingHandler() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1334,6 +1427,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1345,7 +1440,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ApplyCryptographyResponse_AllowsHandlingResponse() |
|
|
public async Task ApplyCryptographyResponse_AllowsHandlingResponse() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1363,6 +1458,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
@ -1374,7 +1471,7 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
public async Task ApplyCryptographyResponse_ResponseContainsCustomParameters() |
|
|
public async Task ApplyCryptographyResponse_ResponseContainsCustomParameters() |
|
|
{ |
|
|
{ |
|
|
// Arrange
|
|
|
// Arrange
|
|
|
var client = CreateClient(options => |
|
|
await using var server = await CreateServerAsync(options => |
|
|
{ |
|
|
{ |
|
|
options.EnableDegradedMode(); |
|
|
options.EnableDegradedMode(); |
|
|
|
|
|
|
|
|
@ -1392,6 +1489,8 @@ namespace OpenIddict.Server.FunctionalTests |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await using var client = await server.CreateClientAsync(); |
|
|
|
|
|
|
|
|
// Act
|
|
|
// Act
|
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
var response = await client.GetAsync("/.well-known/jwks"); |
|
|
|
|
|
|
|
|
|