ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

【Azure 环境】ADAL(Azure Active Directory Authentication Library )迁移到MSAL(Microsoft Authentication Libra

2021-10-31 18:00:43  阅读:244  来源: 互联网

标签:cache Library Microsoft cacheOptions Authentication ADAL Azure Configuration opt


问题一:根据微软官方网站对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

  1.  如果不在 2022 年 6 月 30 日 ADAL 支持结束前选择迁移到 MSAL,应用的安全性会面临风险。
  2.  使用 ADAL 的现有应用在支持结束日期后将继续工作,但 Microsoft 将不再发布 ADAL 的安全修补程序。
  3.  考虑到继续使用将存在安全风险,微软建议将应用从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;
});

 

详细可参考:https://docs.microsoft.com/zh-cn/azure/active-directory/develop/msal-net-token-cache-serialization?tabs=aspnetcore

 

标签:cache,Library,Microsoft,cacheOptions,Authentication,ADAL,Azure,Configuration,opt
来源: https://www.cnblogs.com/lulight/p/15490240.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有