Tokens can be cached beyond the lifetime of the (http) transport. (#834)
This commit is contained in:
parent
e6db415940
commit
820821fa0c
1 changed files with 538 additions and 373 deletions
17
src/ModelContextProtocol.Core/Authentication/ITokenCache.cs
Normal file
17
src/ModelContextProtocol.Core/Authentication/ITokenCache.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
namespace ModelContextProtocol.Authentication;
|
||||
|
||||
/// <summary>
|
||||
/// Allows the client to cache access tokens beyond the lifetime of the transport.
|
||||
/// </summary>
|
||||
public interface ITokenCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Cache the token. After a new access token is acquired, this method is invoked to store it.
|
||||
/// </summary>
|
||||
ValueTask StoreTokensAsync(TokenContainer tokens, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the cached token. This method is invoked for every request.
|
||||
/// </summary>
|
||||
ValueTask<TokenContainer?> GetTokensAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
Loading…
Reference in a new issue