mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Naming improvements for new config for registration_endpoint in discovery document
This commit is contained in:
parent
b4d0ae7a29
commit
4578a21c15
4 changed files with 19 additions and 19 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#nullable enable
|
||||
namespace Duende.IdentityServer.Configuration;
|
||||
|
||||
public enum RegistrationEndpointType
|
||||
public enum RegistrationEndpointMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Will not show a registration endpoint in the discovery document
|
||||
|
|
@ -12,14 +12,14 @@ public enum RegistrationEndpointType
|
|||
None,
|
||||
|
||||
/// <summary>
|
||||
/// Will use the static URL from <see cref="DynamicClientRegistrationDiscoveryOptions.CustomRegistrationEndpoint"/>
|
||||
/// Will use the static URL from <see cref="DynamicClientRegistrationDiscoveryOptions.StaticRegistrationEndpoint"/>
|
||||
/// </summary>
|
||||
Static,
|
||||
|
||||
/// <summary>
|
||||
/// Will generate the URL dynamically based on the host
|
||||
/// Will infer the URL dynamically based on the host
|
||||
/// </summary>
|
||||
Dynamic
|
||||
Inferred
|
||||
}
|
||||
|
||||
public class DynamicClientRegistrationDiscoveryOptions
|
||||
|
|
@ -30,13 +30,13 @@ public class DynamicClientRegistrationDiscoveryOptions
|
|||
/// <value>
|
||||
/// The type of the registration endpoint.
|
||||
/// </value>
|
||||
public RegistrationEndpointType RegistrationEndpointType { get; set; } = RegistrationEndpointType.None;
|
||||
public RegistrationEndpointMode RegistrationEndpointMode { get; set; } = RegistrationEndpointMode.None;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the custom registration endpoint
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The URL of the authorization endpoint to use in the discovery document if <see cref="RegistrationEndpointType"/> is set to <see cref="RegistrationEndpointType.Static"/>.
|
||||
/// The URL of the authorization endpoint to use in the discovery document if <see cref="RegistrationEndpointMode"/> is set to <see cref="RegistrationEndpointMode.Static"/>.
|
||||
/// </value>
|
||||
public Uri? CustomRegistrationEndpoint { get; set; }
|
||||
public Uri? StaticRegistrationEndpoint { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,8 +216,8 @@ public static class IdentityServerApplicationBuilderExtensions
|
|||
throw new InvalidOperationException("CorsPolicyName is not configured");
|
||||
}
|
||||
|
||||
if (options.Discovery.DynamicClientRegistration.RegistrationEndpointType == RegistrationEndpointType.Static
|
||||
&& options.Discovery.DynamicClientRegistration.CustomRegistrationEndpoint == null)
|
||||
if (options.Discovery.DynamicClientRegistration.RegistrationEndpointMode == RegistrationEndpointMode.Static
|
||||
&& options.Discovery.DynamicClientRegistration.StaticRegistrationEndpoint == null)
|
||||
{
|
||||
throw new InvalidOperationException("DynamicClientRegistration.CustomRegistrationEndpoint must be set when using static registration endpoint type.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,18 +409,18 @@ public class DiscoveryResponseGenerator : IDiscoveryResponseGenerator
|
|||
entries.Add(OidcConstants.Discovery.DPoPSigningAlgorithmsSupported, Options.DPoP.SupportedDPoPSigningAlgorithms);
|
||||
}
|
||||
|
||||
switch (Options.Discovery.DynamicClientRegistration.RegistrationEndpointType)
|
||||
switch (Options.Discovery.DynamicClientRegistration.RegistrationEndpointMode)
|
||||
{
|
||||
case RegistrationEndpointType.Static:
|
||||
if (Options.Discovery.DynamicClientRegistration.CustomRegistrationEndpoint != null)
|
||||
case RegistrationEndpointMode.Static:
|
||||
if (Options.Discovery.DynamicClientRegistration.StaticRegistrationEndpoint != null)
|
||||
{
|
||||
entries.Add(OidcConstants.Discovery.RegistrationEndpoint, Options.Discovery.DynamicClientRegistration.CustomRegistrationEndpoint.ToString());
|
||||
entries.Add(OidcConstants.Discovery.RegistrationEndpoint, Options.Discovery.DynamicClientRegistration.StaticRegistrationEndpoint.ToString());
|
||||
}
|
||||
break;
|
||||
case RegistrationEndpointType.Dynamic:
|
||||
case RegistrationEndpointMode.Inferred:
|
||||
entries.Add(OidcConstants.Discovery.RegistrationEndpoint, baseUrl + ProtocolRoutePaths.DynamicClientRegistration);
|
||||
break;
|
||||
case RegistrationEndpointType.None:
|
||||
case RegistrationEndpointMode.None:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,8 +474,8 @@ public class DiscoveryEndpointTests
|
|||
{
|
||||
var pipeline = new IdentityServerPipeline();
|
||||
pipeline.Initialize();
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointType = RegistrationEndpointType.Static;
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.CustomRegistrationEndpoint = new Uri("https://custom.example.com/register");
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointMode = RegistrationEndpointMode.Static;
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.StaticRegistrationEndpoint = new Uri("https://custom.example.com/register");
|
||||
|
||||
var result = await pipeline.BackChannelClient.GetAsync("https://server/.well-known/openid-configuration");
|
||||
var json = await result.Content.ReadAsStringAsync();
|
||||
|
|
@ -490,7 +490,7 @@ public class DiscoveryEndpointTests
|
|||
{
|
||||
var pipeline = new IdentityServerPipeline();
|
||||
pipeline.Initialize();
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointType = RegistrationEndpointType.Dynamic;
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointMode = RegistrationEndpointMode.Inferred;
|
||||
|
||||
var result = await pipeline.BackChannelClient.GetAsync("https://server/.well-known/openid-configuration");
|
||||
var json = await result.Content.ReadAsStringAsync();
|
||||
|
|
@ -505,7 +505,7 @@ public class DiscoveryEndpointTests
|
|||
{
|
||||
var pipeline = new IdentityServerPipeline();
|
||||
pipeline.Initialize();
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointType = RegistrationEndpointType.None;
|
||||
pipeline.Options.Discovery.DynamicClientRegistration.RegistrationEndpointMode = RegistrationEndpointMode.None;
|
||||
|
||||
var result = await pipeline.BackChannelClient.GetAsync("https://server/.well-known/openid-configuration");
|
||||
var json = await result.Content.ReadAsStringAsync();
|
||||
|
|
|
|||
Loading…
Reference in a new issue