Authorization Server & Protected Resource Metadata inspection
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- csharp
調査の方向性
ClientOAuthOptions と、認可サーバーおよび保護されたリソースのメタデータを取得する MCP クライアントパスから始めます。既存の AuthorizationRedirectDelegate と関連する認証コードを確認し、その後、提案されている delegate および ClientOAuthEvents の設計を、キャッシュに関する問題も含めて比較します。完了の条件は、選択した公開 API が要求されたメタデータへのアクセスを一貫して公開し、選択したコールバックのカバレッジがあることです。
索引モデルが issue の本文から書いたものです。
説明
Sometimes we need access to the AS metadata & PRM. For example, if we want to implement logout we need access to the logout endpoint which resides on the AS metadata, and this AS metadata is already fetched by the MCP client. Another use case is to conditionally inspect the claims in the access token based on the AS that was used for the authentication (e.g getting the user name & display name claims etc.)
a.
One design might be to add a few more delegates to ClientOAuthOptions:
namespace ModelContextProtocol.Authentication;
public sealed class ClientOAuthOptions
{
...
/// <summary>
/// Gets or sets the delegate called when authorization server metadata is retrieved.
/// </summary>
public Action<AuthorizationServerMetadata> OnAuthorizationServerMetadataRetrieved { get; set; }
/// <summary>
/// Gets or sets the delegate called when protected resource metadata is retrieved.
/// </summary>
public Action<ProtectedResourceMetadata> OnProtectedResourceMetadataRetrieved { get; set; }
...
}
Having them as delegates/events avoids having to manage and expose state on the McpClient instance.
b.
Another design might be to use something similar to the pattern in used by ASP.NET Core auth.
namespace ModelContextProtocol.Authentication;
public sealed class RetrievingAuthorizationServerMetadataContext ...;
public sealed class RetrievedAuthorizationServerMetadataContext ...;
public sealed class RetrievingProtectedResourceMetadataContext ...;
public sealed class RetrievedProtectedResourceMetadataContext ...;
public sealed class ClientOAuthEvents
{
/// <summary>
/// Gets or sets the delegate called before authorization server metadata is retrieved.
/// </summary>
public Func<RetrievingAuthorizationServerMetadataContext, Task> OnRetrievingAuthorizationServerMetadata { get; set; } = ...;
/// <summary>
/// Gets or sets the delegate called after authorization server metadata is retrieved.
/// </summary>
public Func<RetrievedAuthorizationServerMetadataContext, Task> OnRetrievedAuthorizationServerMetadata { get; set; } = ...;
/// <summary>
/// Gets or sets the delegate called before protected resource metadata is retrieved.
/// </summary>
public Func<RetrievingProtectedResourceMetadataContext, Task> OnRetrievingProtectedResourceMetadata { get; set; } = ...;
/// <summary>
/// Gets or sets the delegate called after protected resource metadata is retrieved.
/// </summary>
public Func<RetrievedProtectedResourceMetadataContext, Task> OnRetrievedProtectedResourceMetadata { get; set; } = ...;
}
public sealed class ClientOAuthOptions
{
...
/// <summary>
/// Gets or sets the <see cref="ClientOAuthEvents" />.
/// </summary>
public ClientOAuthEvents Events { get; set; } = new();
...
}
The idea behind the "Retrieving" variants is that it allows the user to implement metadata caching, although it also expands the ability for the user to shoot themselves in the foot. I suppose it depends on if caching is a user level concern or a library level concern.
The AuthorizationRedirectDelegate on ClientOAuthOptions can also be moved into the ClientOAuthEvents class to make the surface more uniform.
The overall surface may be reduced if we combine them into a single OnRetrievedMetadata and OnRetrievingMetadata, but trickiness in the contexts I suppose.
- 主要言語
- C#
- スター
- 4.5k
- フォーク
- 814
- 平均マージ
- 9日 19時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/csharp-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modelcontextprotocol/csharp-sdk#1840 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
modelcontextprotocol/csharp-sdk#678 · コメント 1 件 ·
-
enhancement needs confirmation P3 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/csharp-sdk#515 · コメント 6 件 · リアクション 3 件 ·
modelcontextprotocol/csharp-sdk の issue をすべて見る
似ている issue
-
area-ai untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/extensions#7783 ·
-
untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
type/automation type/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
newrelic/newrelic-dotnet-agent#3850 · コメント 1 件 ·