TokenCacheExtensions.AddInMemoryTokenCache Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AddInMemoryTokenCache(IConfidentialClientApplication) |
Add an in-memory well partitioned token cache to MSAL.NET confidential client
application. Don't use this method in ASP.NET Core: rather use:
|
AddInMemoryTokenCache(IConfidentialClientApplication, Action<IServiceCollection>) |
Add an in-memory well partitioned token cache to MSAL.NET confidential client
application. Don't use this method in ASP.NET Core: rather use:
|
AddInMemoryTokenCache(IConfidentialClientApplication)
Add an in-memory well partitioned token cache to MSAL.NET confidential client
application. Don't use this method in ASP.NET Core: rather use:
services.AddInMemoryTokenCache()
in ConfigureServices.
public static Microsoft.Identity.Client.IConfidentialClientApplication AddInMemoryTokenCache (this Microsoft.Identity.Client.IConfidentialClientApplication confidentialClientApp);
static member AddInMemoryTokenCache : Microsoft.Identity.Client.IConfidentialClientApplication -> Microsoft.Identity.Client.IConfidentialClientApplication
<Extension()>
Public Function AddInMemoryTokenCache (confidentialClientApp As IConfidentialClientApplication) As IConfidentialClientApplication
Parameters
- confidentialClientApp
- IConfidentialClientApplication
Confidential client application.
Returns
The application for chaining.
Examples
The following code adds an in-memory token cache.
app.AddInMemoryTokenCache();
Remarks
Don't use this method in ASP.NET Core. Just add use the ConfigureServices method instead.
Applies to
AddInMemoryTokenCache(IConfidentialClientApplication, Action<IServiceCollection>)
Add an in-memory well partitioned token cache to MSAL.NET confidential client
application. Don't use this method in ASP.NET Core: rather use:
services.AddInMemoryTokenCache()
in ConfigureServices.
public static Microsoft.Identity.Client.IConfidentialClientApplication AddInMemoryTokenCache (this Microsoft.Identity.Client.IConfidentialClientApplication confidentialClientApp, Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> initializeMemoryCache);
static member AddInMemoryTokenCache : Microsoft.Identity.Client.IConfidentialClientApplication * Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.Identity.Client.IConfidentialClientApplication
<Extension()>
Public Function AddInMemoryTokenCache (confidentialClientApp As IConfidentialClientApplication, initializeMemoryCache As Action(Of IServiceCollection)) As IConfidentialClientApplication
Parameters
- confidentialClientApp
- IConfidentialClientApplication
Confidential client application.
- initializeMemoryCache
- Action<IServiceCollection>
Action taking a IServiceCollection and by which you initialize your memory cache.
Returns
The application for chaining.
Examples
The following code adds an in-memory token cache.
app.AddInMemoryTokenCache(services =>
{
services.Configure<MemoryCacheOptions>(options =>
{
options.SizeLimit = 5000000; // in bytes (5 Mb), for example
});
});
Remarks
Don't use this method in ASP.NET Core. Just add use the ConfigureServices method instead.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈