问题一:根据微软官方网站对ADAL(包含ADAL.js, ADAL.NET, ADAL4J)的声明https://docs.microsoft.com/zh-cn/azure/active-directory/develop/msal-migration, 在2022年6月30日后微软对于ADAL不再提供任何技术支
问题一:根据微软官方网站对ADAL(包含ADAL.js, ADAL.NET, ADAL4J)的声明 https://docs.microsoft.com/zh-cn/azure/active-directory/develop/msal-migration, 在2022年6月30日后微软对于ADAL不再提供任何技术支持。对于已经存在的使用ADAL(例如ADAL.js 的SPA应用)的系统,会面临什么样的风险?微软对相关风险的处理有什么建议? 另外, 该声明是否意味着2022年6月30日后采用ADAL的旧系统很大可能性不能再正常使用Azure AD服务了?
答案:包含在文档中的警告部分,https://docs.microsoft.com/zh-cn/azure/active-directory/develop/msal-migration
问题二:MSAL库是否提供了对Distirbuted Token Cache的实现
对于ASP.NET Core的应用,可以参考使用AddDistributedTokenCaches方法来实现:
// or use a distributed Token Cache by addingservices.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { scopesToRequest }
.AddDistributedTokenCaches();
// and then choose your implementation of distributed cache
// For instance the distributed in memory cache (not cleared when you stop the app)
services.AddDistributedMemoryCache();
// Or a Redis cache
// Requires the Microsoft.Extensions.Caching.StackExchangeRedis NuGet package
services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "SampleInstance";
});
// Or even a SQL Server token cache
// Requires the Microsoft.Extensions.Caching.SqlServer NuGet package
services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString = _config["DistCache_ConnectionString"];
options.SchemaName = "dbo";
options.TableName = "TestCache";
});
// Or a Cosmos DB cache
// Requires the Microsoft.Extensions.Caching.Cosmos NuGet package
services.AddCosmosCache((CosmosCacheOptions cacheOptions) =>
{
cacheOptions.ContainerName = Configuration["CosmosCacheContainer"];
cacheOptions.DatabaseName = Configuration["CosmosCacheDatabase"];
cacheOptions.ClientBuilder = new CosmosClientBuilder(Configuration["CosmosConnectionString"]);
cacheOptions.CreateIfNotExists = true;
});
详细可参考:https://docs.microsoft.com/zh-cn/azure/active-directory/develop/msal-net-token-cache-serialization?tabs=aspnetcore
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!