Authorization Server & Protected Resource Metadata inspection
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- csharp
- Área
- authentication, authorization
Línea de trabajo
Comienza con ClientOAuthOptions y la ruta del cliente MCP que obtiene los metadatos del servidor de autorización y del recurso protegido. Revisa el AuthorizationRedirectDelegate existente y el código de autenticación relacionado; después, compara los diseños propuestos de delegate y ClientOAuthEvents, incluida la cuestión de la caché. Se considera terminado cuando la API pública elegida expone de forma coherente el acceso a los metadatos solicitados y existe cobertura para los callbacks seleccionados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 4.5k
- Forks
- 814
- Merge medio
- 9 d 19 h
- PR fusionados (30 d)
- 4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/csharp-sdk
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comentario ·
-
enhancement needs confirmation P3 ready for work
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comentarios · 3 reacciones ·
Todos los issues de modelcontextprotocol/csharp-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
bug needs response
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Adyen/adyen-dotnet-api-library#1869 ·
-
Status: Needs Triage Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
bug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nightscout/nocturne#1602 ·