Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix discovery document to not print null for bolean properties #125

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions src/Models/Authentication/DiscoveryDocument.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
using System.Text.Json.Serialization;

namespace Altinn.Platform.Authentication.Model
Expand All @@ -12,120 +13,135 @@ public class DiscoveryDocument
/// URL of the issuer
/// </summary>
[JsonPropertyName("issuer")]
public string Issuer { get; set; }
public required string Issuer { get; set; }

/// <summary>
/// URL of the JSON Web Key Set document.
/// </summary>
[JsonPropertyName("jwks_uri")]
public string JwksUri { get; set; }
public required string JwksUri { get; set; }

/// <summary>
/// URL of the OAuth 2.0 Authorization Endpoint.
/// </summary>
[JsonPropertyName("authorization_endpoint")]
public string AuthorizationEndpoint { get; set; }
public required string AuthorizationEndpoint { get; set; }

/// <summary>
/// URL of the OAuth 2.0 Token Endpoint.
/// </summary>
[JsonPropertyName("token_endpoint")]
public string TokenEndpoint { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TokenEndpoint { get; set; }

/// <summary>
/// Url of the UserInfo Endpoint.
/// </summary>
[JsonPropertyName("userinfo_endpoint")]
public string UserinfoEndpoint { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? UserinfoEndpoint { get; set; }

/// <summary>
/// URL of the end session Endpoint.
/// </summary>
[JsonPropertyName("end_session_endpoint")]
public string EndSessionEndpoint { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? EndSessionEndpoint { get; set; }

/// <summary>
/// URL for the session check Endpoint.
/// </summary>
[JsonPropertyName("check_session_iframe")]
public string CheckSessionIframe { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CheckSessionIframe { get; set; }

/// <summary>
/// URL for the revocation endpoint.
/// </summary>
[JsonPropertyName("revocation_endpoint")]
public string RevocationEndpoint { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? RevocationEndpoint { get; set; }

/// <summary>
/// URL for the introspection endpoint.
/// </summary>
[JsonPropertyName("introspection_endpoint")]
public string IntrospectionEndpoint { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? IntrospectionEndpoint { get; set; }

/// <summary>
/// Value indicating whether there is a front channel mechanism for logout.
/// </summary>
[JsonPropertyName("frontchannel_logout_supported")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? FrontchannelLogoutSupported { get; set; }

/// <summary>
/// Value indicating wheter there is a front channel mechanism for session logout.
/// </summary>
[JsonPropertyName("frontchannel_logout_session_supported")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? FrontchannelLogoutSessionSupported { get; set; }

/// <summary>
/// Array of supported scopes.
/// </summary>
[JsonPropertyName("scopes_supported")]
public string[] ScopesSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? ScopesSupported { get; set; }

/// <summary>
/// Array of supported claims.
/// </summary>
[JsonPropertyName("claims_supported")]
public string[] ClaimsSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? ClaimsSupported { get; set; }

/// <summary>
/// Array of supported response types.
/// </summary>
[JsonPropertyName("response_types_supported")]
public string[] ResponseTypesSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? ResponseTypesSupported { get; set; }

/// <summary>
/// Array of supported response modes.
/// </summary>
[JsonPropertyName("response_modes_supported")]
public string[] ResponseModesSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? ResponseModesSupported { get; set; }

/// <summary>
/// Array of supported grant types.
/// </summary>
[JsonPropertyName("grant_types_supported")]
public string[] GrantTypesSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? GrantTypesSupported { get; set; }

/// <summary>
/// Array of supported subject types.
/// </summary>
[JsonPropertyName("subject_types_supported")]
public string[] SubjectTypesSupported { get; set; }
public required string[] SubjectTypesSupported { get; set; }

/// <summary>
/// Array of supported signing algorithms.
/// </summary>
[JsonPropertyName("id_token_signing_alg_values_supported")]
public string[] IdTokenSigningAlgValuesSupported { get; set; }
public required string[] IdTokenSigningAlgValuesSupported { get; set; }

/// <summary>
/// Array of supported authentication methods on the token endpoint.
/// </summary>
[JsonPropertyName("token_endpoint_auth_methods_supported")]
public string[] TokenEndpointAuthMethodsSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? TokenEndpointAuthMethodsSupported { get; set; }

/// <summary>
/// Array of supported code challenge methods.
/// </summary>
[JsonPropertyName("code_challenge_methods_supported")]
public string[] CodeChallengeMethodsSupported { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? CodeChallengeMethodsSupported { get; set; }
}
}
}
Loading