Skip to content

Commit bf9f63e

Browse files
committed
Cleanup of unused declarations
1 parent 2f44765 commit bf9f63e

File tree

6 files changed

+13
-29
lines changed

6 files changed

+13
-29
lines changed

src/ModelContextProtocol/Protocol/Auth/AuthorizationContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Diagnostics;
2-
31
namespace ModelContextProtocol.Protocol.Auth;
42

53
/// <summary>

src/ModelContextProtocol/Protocol/Auth/AuthorizationOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
41
namespace ModelContextProtocol.Protocol.Auth;
52

63
/// <summary>

src/ModelContextProtocol/Protocol/Auth/AuthorizationService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
using ModelContextProtocol.Utils;
2+
using ModelContextProtocol.Utils.Json;
13
using System.Net;
24
using System.Net.Http.Headers;
35
using System.Security.Cryptography;
46
using System.Text;
57
using System.Text.Json;
6-
using ModelContextProtocol.Utils;
7-
using ModelContextProtocol.Utils.Json;
88

99
namespace ModelContextProtocol.Protocol.Auth;
1010

src/ModelContextProtocol/Protocol/Auth/IAuthorizationHandler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Net;
2-
31
namespace ModelContextProtocol.Protocol.Auth;
42

53
/// <summary>

src/ModelContextProtocol/Protocol/Auth/IServerAuthorizationProvider.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Text.Json;
2-
31
namespace ModelContextProtocol.Protocol.Auth;
42

53
/// <summary>

src/ModelContextProtocol/Server/Auth/SimpleServerAuthorizationProvider.cs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using ModelContextProtocol.Protocol.Auth;
2-
using System.Security.Claims;
32

43
namespace ModelContextProtocol.Server.Auth;
54

@@ -11,24 +10,18 @@ namespace ModelContextProtocol.Server.Auth;
1110
/// it should be extended or replaced with a more robust implementation that integrates with your
1211
/// authentication system (e.g., OAuth 2.0 server, identity provider, etc.)
1312
/// </remarks>
14-
public class SimpleServerAuthorizationProvider : IServerAuthorizationProvider
13+
/// <remarks>
14+
/// Initializes a new instance of the <see cref="SimpleServerAuthorizationProvider"/> class
15+
/// with the specified resource metadata and token validator.
16+
/// </remarks>
17+
/// <param name="resourceMetadata">The protected resource metadata.</param>
18+
/// <param name="tokenValidator">A function that validates access tokens. If not provided, a function that always returns true will be used.</param>
19+
public class SimpleServerAuthorizationProvider(
20+
ProtectedResourceMetadata resourceMetadata,
21+
Func<string, Task<bool>>? tokenValidator = null) : IServerAuthorizationProvider
1522
{
16-
private readonly ProtectedResourceMetadata _resourceMetadata;
17-
private readonly Func<string, Task<bool>> _tokenValidator;
18-
19-
/// <summary>
20-
/// Initializes a new instance of the <see cref="SimpleServerAuthorizationProvider"/> class
21-
/// with the specified resource metadata and token validator.
22-
/// </summary>
23-
/// <param name="resourceMetadata">The protected resource metadata.</param>
24-
/// <param name="tokenValidator">A function that validates access tokens. If not provided, a function that always returns true will be used.</param>
25-
public SimpleServerAuthorizationProvider(
26-
ProtectedResourceMetadata resourceMetadata,
27-
Func<string, Task<bool>>? tokenValidator = null)
28-
{
29-
_resourceMetadata = resourceMetadata ?? throw new ArgumentNullException(nameof(resourceMetadata));
30-
_tokenValidator = tokenValidator ?? (_ => Task.FromResult(true));
31-
}
23+
private readonly ProtectedResourceMetadata _resourceMetadata = resourceMetadata ?? throw new ArgumentNullException(nameof(resourceMetadata));
24+
private readonly Func<string, Task<bool>> _tokenValidator = tokenValidator ?? (_ => Task.FromResult(true));
3225

3326
/// <inheritdoc />
3427
public ProtectedResourceMetadata GetProtectedResourceMetadata() => _resourceMetadata;

0 commit comments

Comments
 (0)