【Azure 环境】ADAL(Azure Active Directory Authentication Library )迁移到MSAL(Microsoft Authentication Library)相关问题
问题一:根据微软官方网站对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
- 如果不在 2022 年 6 月 30 日 ADAL 支持结束前选择迁移到 MSAL,应用的安全性会面临风险。
- 使用 ADAL 的现有应用在支持结束日期后将继续工作,但 Microsoft 将不再发布 ADAL 的安全修补程序。
- 考虑到继续使用将存在安全风险,微软建议将应用从ADAL迁移到MSAL。
问题二:MSAL库是否提供了对Distirbuted Token Cache的实现
对于ASP.NET Core的应用,可以参考使用AddDistributedTokenCaches方法来实现:
// or use a distributed Token Cache by adding services.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; });
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?