ServiceCollectionExtensions.AddTokenAcquisition 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.
Add the token acquisition service.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddTokenAcquisition (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, bool isTokenAcquisitionSingleton = false);
static member AddTokenAcquisition : Microsoft.Extensions.DependencyInjection.IServiceCollection * bool -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddTokenAcquisition (services As IServiceCollection, Optional isTokenAcquisitionSingleton As Boolean = false) As IServiceCollection
Parameters
- services
- IServiceCollection
Service collection.
- isTokenAcquisitionSingleton
- Boolean
Specifies if an instance of ITokenAcquisition should be a singleton.
Returns
The service collection.
Examples
This method is typically called from the ConfigureServices(IServiceCollection services)
in Startup.cs.
Note that the implementation of the token cache can be chosen separately.
// Token acquisition service and its cache implementation as a session cache
services.AddTokenAcquisition()
.AddDistributedMemoryCache()
.AddSession()
.AddSessionBasedTokenCache();