Skip to content

Commit 249eed1

Browse files
committed
Make ClientRegistrationResponse compatible with the typescript-sdk simpleOAuthClient sample
1 parent 60f5631 commit 249eed1

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

tests/ModelContextProtocol.TestOAuthServer/ClientRegistrationResponse.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,113 +17,131 @@ internal sealed class ClientRegistrationResponse
1717
/// Gets or sets the client secret.
1818
/// </summary>
1919
[JsonPropertyName("client_secret")]
20+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2021
public string? ClientSecret { get; init; }
2122

23+
/// <summary>
24+
/// Gets or sets the redirect URIs for the client.
25+
/// </summary>
26+
[JsonPropertyName("redirect_uris")]
27+
public required List<string> RedirectUris { get; init; }
28+
2229
/// <summary>
2330
/// Gets or sets the registration access token.
2431
/// </summary>
2532
[JsonPropertyName("registration_access_token")]
33+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2634
public string? RegistrationAccessToken { get; init; }
2735

2836
/// <summary>
2937
/// Gets or sets the registration client URI.
3038
/// </summary>
3139
[JsonPropertyName("registration_client_uri")]
40+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3241
public string? RegistrationClientUri { get; init; }
3342

3443
/// <summary>
3544
/// Gets or sets the client ID issued timestamp.
3645
/// </summary>
3746
[JsonPropertyName("client_id_issued_at")]
47+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
3848
public long? ClientIdIssuedAt { get; init; }
3949

4050
/// <summary>
4151
/// Gets or sets the client secret expiration time.
4252
/// </summary>
4353
[JsonPropertyName("client_secret_expires_at")]
54+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
4455
public long? ClientSecretExpiresAt { get; init; }
4556

46-
/// <summary>
47-
/// Gets or sets the redirect URIs for the client.
48-
/// </summary>
49-
[JsonPropertyName("redirect_uris")]
50-
public required List<string> RedirectUris { get; init; }
51-
5257
/// <summary>
5358
/// Gets or sets the token endpoint authentication method.
5459
/// </summary>
5560
[JsonPropertyName("token_endpoint_auth_method")]
61+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
5662
public string? TokenEndpointAuthMethod { get; init; }
5763

5864
/// <summary>
5965
/// Gets or sets the grant types that the client will use.
6066
/// </summary>
6167
[JsonPropertyName("grant_types")]
68+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
6269
public List<string>? GrantTypes { get; init; }
6370

6471
/// <summary>
6572
/// Gets or sets the response types that the client will use.
6673
/// </summary>
6774
[JsonPropertyName("response_types")]
75+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
6876
public List<string>? ResponseTypes { get; init; }
6977

7078
/// <summary>
7179
/// Gets or sets the human-readable name of the client.
7280
/// </summary>
7381
[JsonPropertyName("client_name")]
82+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
7483
public string? ClientName { get; init; }
7584

7685
/// <summary>
7786
/// Gets or sets the URL of the client's home page.
7887
/// </summary>
7988
[JsonPropertyName("client_uri")]
89+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
8090
public string? ClientUri { get; init; }
8191

8292
/// <summary>
8393
/// Gets or sets the URL for the client's logo.
8494
/// </summary>
8595
[JsonPropertyName("logo_uri")]
96+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
8697
public string? LogoUri { get; init; }
8798

8899
/// <summary>
89100
/// Gets or sets the scope values that the client will use.
90101
/// </summary>
91102
[JsonPropertyName("scope")]
103+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
92104
public string? Scope { get; init; }
93105

94106
/// <summary>
95107
/// Gets or sets the contacts for the client.
96108
/// </summary>
97109
[JsonPropertyName("contacts")]
110+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
98111
public List<string>? Contacts { get; init; }
99112

100113
/// <summary>
101114
/// Gets or sets the URL for the client's terms of service.
102115
/// </summary>
103116
[JsonPropertyName("tos_uri")]
117+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
104118
public string? TosUri { get; init; }
105119

106120
/// <summary>
107121
/// Gets or sets the URL for the client's privacy policy.
108122
/// </summary>
109123
[JsonPropertyName("policy_uri")]
124+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
110125
public string? PolicyUri { get; init; }
111126

112127
/// <summary>
113128
/// Gets or sets the JWK Set URL for the client.
114129
/// </summary>
115130
[JsonPropertyName("jwks_uri")]
131+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
116132
public string? JwksUri { get; init; }
117133

118134
/// <summary>
119135
/// Gets or sets the software identifier for the client.
120136
/// </summary>
121137
[JsonPropertyName("software_id")]
138+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
122139
public string? SoftwareId { get; init; }
123140

124141
/// <summary>
125142
/// Gets or sets the software version for the client.
126143
/// </summary>
127144
[JsonPropertyName("software_version")]
145+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
128146
public string? SoftwareVersion { get; init; }
129147
}

0 commit comments

Comments
 (0)