当前位置 : 主页 > 编程语言 > java >

【Azure 环境】ADAL(Azure Active Directory Authentication Library )

来源:互联网 收集:自由互联 发布时间:2022-09-02
问题一:根据微软官方网站对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​​

【Azure 环境】ADAL(Azure Active Directory Authentication Library )_Azure 环境

  • 如果不在 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;
    });

     

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

     

    当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!



    网友评论