Skip to content

Commit 3676c0e

Browse files
committed
Update for consistency
1 parent f9f7c9d commit 3676c0e

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/ModelContextProtocol/Protocol/Auth/AuthorizationContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ internal class AuthorizationContext
1818
/// <summary>
1919
/// Gets or sets the client registration response.
2020
/// </summary>
21-
public ClientRegistrationResponse? ClientRegistration { get; set; }
21+
public ClientRegistration? ClientRegistration { get; set; }
2222

2323
/// <summary>
2424
/// Gets or sets the token response.
2525
/// </summary>
26-
public TokenResponse? TokenResponse { get; set; }
26+
public Token? TokenResponse { get; set; }
2727

2828
/// <summary>
2929
/// Gets or sets the code verifier for PKCE.

src/ModelContextProtocol/Protocol/Auth/AuthorizationService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static Task<AuthorizationServerMetadata> DiscoverAuthorizationServerMetad
174174
/// <param name="clientMetadata">The client metadata for registration.</param>
175175
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. The task result contains the client registration response.</returns>
176176
/// <exception cref="InvalidOperationException">Thrown when the authorization server does not support dynamic client registration.</exception>
177-
public static async Task<ClientRegistrationResponse> RegisterClientAsync(
177+
public static async Task<ClientRegistration> RegisterClientAsync(
178178
AuthorizationServerMetadata metadata,
179179
ClientMetadata clientMetadata)
180180
{
@@ -198,7 +198,7 @@ public static async Task<ClientRegistrationResponse> RegisterClientAsync(
198198
var contentStream = await response.Content.ReadAsStreamAsync();
199199
using var reader = new StreamReader(contentStream);
200200
var json = await reader.ReadToEndAsync();
201-
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.ClientRegistrationResponse);
201+
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.ClientRegistration);
202202

203203
if (result == null)
204204
{
@@ -288,7 +288,7 @@ public static string CreateAuthorizationUrl(
288288
/// <param name="code">The authorization code received from the authorization server.</param>
289289
/// <param name="codeVerifier">The code verifier for PKCE.</param>
290290
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. The task result contains the token response.</returns>
291-
public static async Task<TokenResponse> ExchangeCodeForTokensAsync(
291+
public static async Task<Token> ExchangeCodeForTokensAsync(
292292
AuthorizationServerMetadata metadata,
293293
string clientId,
294294
string? clientSecret,
@@ -330,7 +330,7 @@ public static async Task<TokenResponse> ExchangeCodeForTokensAsync(
330330
var contentStream = await response.Content.ReadAsStreamAsync();
331331
using var reader = new StreamReader(contentStream);
332332
var json = await reader.ReadToEndAsync();
333-
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.TokenResponse);
333+
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.Token);
334334

335335
if (result == null)
336336
{
@@ -348,7 +348,7 @@ public static async Task<TokenResponse> ExchangeCodeForTokensAsync(
348348
/// <param name="clientSecret">The client secret.</param>
349349
/// <param name="refreshToken">The refresh token.</param>
350350
/// <returns>A <see cref="Task"/> that represents the asynchronous operation. The task result contains the token response.</returns>
351-
public static async Task<TokenResponse> RefreshTokenAsync(
351+
public static async Task<Token> RefreshTokenAsync(
352352
AuthorizationServerMetadata metadata,
353353
string clientId,
354354
string? clientSecret,
@@ -384,7 +384,7 @@ public static async Task<TokenResponse> RefreshTokenAsync(
384384
var contentStream = await response.Content.ReadAsStreamAsync();
385385
using var reader = new StreamReader(contentStream);
386386
var json = await reader.ReadToEndAsync();
387-
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.TokenResponse);
387+
var result = JsonSerializer.Deserialize(json, McpJsonUtilities.JsonContext.Default.Token);
388388

389389
if (result == null)
390390
{

src/ModelContextProtocol/Protocol/Auth/ClientRegistrationResponse.cs renamed to src/ModelContextProtocol/Protocol/Auth/ClientRegistration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ModelContextProtocol.Protocol.Auth;
55
/// <summary>
66
/// Represents the OAuth 2.0 client registration response as defined in RFC 7591.
77
/// </summary>
8-
public class ClientRegistrationResponse
8+
public class ClientRegistration
99
{
1010
/// <summary>
1111
/// Gets or sets the OAuth 2.0 client identifier string.

src/ModelContextProtocol/Protocol/Auth/DefaultAuthorizationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public async Task<bool> HandleUnauthorizedResponseAsync(HttpResponseMessage resp
140140
_logger.LogDebug("Using pre-configured client ID: {ClientId}", _clientId);
141141

142142
// Create a client registration response to store in the context
143-
var clientRegistration = new ClientRegistrationResponse
143+
var clientRegistration = new ClientRegistration
144144
{
145145
ClientId = _clientId!, // Using null-forgiving operator since we've already checked it's not null
146146
ClientSecret = _clientSecret,

src/ModelContextProtocol/Protocol/Auth/TokenResponse.cs renamed to src/ModelContextProtocol/Protocol/Auth/Token.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ModelContextProtocol.Protocol.Auth;
55
/// <summary>
66
/// Represents the OAuth 2.0 token response as defined in RFC 6749.
77
/// </summary>
8-
public class TokenResponse
8+
public class Token
99
{
1010
/// <summary>
1111
/// Gets or sets the access token issued by the authorization server.

src/ModelContextProtocol/Utils/Json/McpJsonUtilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ internal static bool IsValidMcpToolSchema(JsonElement element)
127127
[JsonSerializable(typeof(Protocol.Auth.ProtectedResourceMetadata))]
128128
[JsonSerializable(typeof(Protocol.Auth.AuthorizationServerMetadata))]
129129
[JsonSerializable(typeof(Protocol.Auth.ClientMetadata))]
130-
[JsonSerializable(typeof(Protocol.Auth.ClientRegistrationResponse))]
131-
[JsonSerializable(typeof(Protocol.Auth.TokenResponse))]
130+
[JsonSerializable(typeof(Protocol.Auth.ClientRegistration))]
131+
[JsonSerializable(typeof(Protocol.Auth.Token))]
132132

133133
[ExcludeFromCodeCoverage]
134134
internal sealed partial class JsonContext : JsonSerializerContext;

0 commit comments

Comments
 (0)