Skip to content

Commit

Permalink
Add additional metadata parameters to OpenIdConnectConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
joegoldman2 authored and brentschmaltz committed Jun 14, 2024
1 parent cb49356 commit c3ead8a
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public class OpenIdConnectConfiguration : BaseConfiguration
private ICollection<string> _userInfoEndpointEncryptionAlgValuesSupported;
private ICollection<string> _userInfoEndpointEncryptionEncValuesSupported;
private ICollection<string> _userInfoEndpointSigningAlgValuesSupported;
private ICollection<string> _promptValuesSupported;
private ICollection<string> _backchannelTokenDeliveryModesSupported;
private ICollection<string> _backchannelAuthenticationRequestSigningAlgValuesSupported;
private ICollection<string> _dPoPSigningAlgValuesSupported;

/// <summary>
/// Deserializes the json string into an <see cref="OpenIdConnectConfiguration"/> object.
Expand Down Expand Up @@ -534,6 +538,87 @@ public OpenIdConnectConfiguration(string json)
Interlocked.CompareExchange(ref _userInfoEndpointSigningAlgValuesSupported, new Collection<string>(), null) ??
_userInfoEndpointSigningAlgValuesSupported;

/// <summary>
/// Gets the collection of 'prompt_values_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.PromptValuesSupported)]
public ICollection<string> PromptValuesSupported =>
_promptValuesSupported ??
Interlocked.CompareExchange(ref _promptValuesSupported, new Collection<string>(), null) ??
_promptValuesSupported;

/// <summary>
/// Gets or sets the 'pushed_authorization_request_endpoint'.
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.PushedAuthorizationRequestEndpoint)]
#if NET6_0_OR_GREATER
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
#endif
public string PushedAuthorizationRequestEndpoint { get; set; }

/// <summary>
/// Gets or sets the 'require_pushed_authorization_requests'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.RequirePushedAuthorizationRequests)]
#if NET6_0_OR_GREATER
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
#endif
public bool RequirePushedAuthorizationRequests { get; set; }

/// <summary>
/// Gets or sets the 'backchannel_authentication_endpoint'.
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.BackchannelAuthenticationEndpoint)]
#if NET6_0_OR_GREATER
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
#endif
public string BackchannelAuthenticationEndpoint { get; set; }

/// <summary>
/// Gets the collection of 'backchannel_token_delivery_modes_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.BackchannelTokenDeliveryModesSupported)]
public ICollection<string> BackchannelTokenDeliveryModesSupported =>
_backchannelTokenDeliveryModesSupported ??
Interlocked.CompareExchange(ref _backchannelTokenDeliveryModesSupported, new Collection<string>(), null) ??
_backchannelTokenDeliveryModesSupported;

/// <summary>
/// Gets the collection of 'backchannel_authentication_request_signing_alg_values_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.BackchannelAuthenticationRequestSigningAlgValuesSupported)]
public ICollection<string> BackchannelAuthenticationRequestSigningAlgValuesSupported =>
_backchannelAuthenticationRequestSigningAlgValuesSupported ??
Interlocked.CompareExchange(ref _backchannelAuthenticationRequestSigningAlgValuesSupported, new Collection<string>(), null) ??
_backchannelAuthenticationRequestSigningAlgValuesSupported;

/// <summary>
/// Gets or sets the 'backchannel_user_code_parameter_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.BackchannelUserCodeParameterSupported)]
#if NET6_0_OR_GREATER
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
#endif
public bool BackchannelUserCodeParameterSupported { get; set; }

/// <summary>
/// Gets the collection of 'dpop_signing_alg_values_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.DPoPSigningAlgValuesSupported)]
public ICollection<string> DPoPSigningAlgValuesSupported =>
_dPoPSigningAlgValuesSupported ??
Interlocked.CompareExchange(ref _dPoPSigningAlgValuesSupported, new Collection<string>(), null) ??
_dPoPSigningAlgValuesSupported;

/// <summary>
/// Gets or sets the 'authorization_response_iss_parameter_supported'
/// </summary>
[JsonPropertyName(OpenIdProviderMetadataNames.AuthorizationResponseIssParameterSupported)]
#if NET6_0_OR_GREATER
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
#endif
public bool AuthorizationResponseIssParameterSupported { get; set; }

#region shouldserialize
// TODO - should we keep these, they were used by Newtonsoft to control serialization of collections.
// May help users to keep them hanging around.
Expand Down Expand Up @@ -812,6 +897,49 @@ public bool ShouldSerializeUserInfoEndpointSigningAlgValuesSupported()
return UserInfoEndpointSigningAlgValuesSupported.Count > 0;
}

/// <summary>
/// Gets a bool that determines if the 'prompt_values_supported' (PromptValuesSupported) property should be serialized.
/// This is used by Json.NET in order to conditionally serialize properties.
/// </summary>
/// <return>true if 'prompt_values_supported' (PromptValuesSupported) is not empty; otherwise, false.</return>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializePromptValuesSupported()
{
return PromptValuesSupported.Count > 0;
}

/// <summary>
/// Gets a bool that determines if the 'backchannel_token_delivery_modes_supported' (BackchannelTokenDeliveryModesSupported) property should be serialized.
/// This is used by Json.NET in order to conditionally serialize properties.
/// </summary>
/// <return>true if 'backchannel_token_delivery_modes_supported' (BackchannelTokenDeliveryModesSupported) is not empty; otherwise, false.</return>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeBackchannelTokenDeliveryModesSupported()
{
return BackchannelTokenDeliveryModesSupported.Count > 0;
}

/// <summary>
/// Gets a bool that determines if the 'backchannel_authentication_request_signing_alg_values_supported' (BackchannelAuthenticationRequestSigningAlgValuesSupported) property should be serialized.
/// This is used by Json.NET in order to conditionally serialize properties.
/// </summary>
/// <return>true if 'backchannel_authentication_request_signing_alg_values_supported' (BackchannelAuthenticationRequestSigningAlgValuesSupported) is not empty; otherwise, false.</return>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeBackchannelAuthenticationRequestSigningAlgValuesSupported()
{
return BackchannelAuthenticationRequestSigningAlgValuesSupported.Count > 0;
}

/// <summary>
/// Gets a bool that determines if the 'dpop_signing_alg_values_supported' (DPoPSigningAlgValuesSupported) property should be serialized.
/// This is used by Json.NET in order to conditionally serialize properties.
/// </summary>
/// <return>true if 'dpop_signing_alg_values_supported' (DPoPSigningAlgValuesSupported) is not empty; otherwise, false.</return>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeDPoPSigningAlgValuesSupported()
{
return DPoPSigningAlgValuesSupported.Count > 0;
}
#endregion shouldserialize
}
}
Loading

0 comments on commit c3ead8a

Please sign in to comment.