Azure ADAL库在Azure环境中如何实现身份验证?

2026-06-10 01:501阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计545个文字,预计阅读时间需要3分钟。

Azure ADAL库在Azure环境中如何实现身份验证?

问题一:根据微软官方文档,2022年6月30日后,微软将不再对ADAL(包括ADAL.js、ADAL.NET、ADAL4J)提供任何技术支持。

问题一:根据微软官方网站对ADAL(包含ADAL.js, ADAL.NET, ADAL4J)的声明​​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服务了?

答案:包含在文档中的警告部分,​​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;
    });

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

    Azure ADAL库在Azure环境中如何实现身份验证?

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



    本文共计545个文字,预计阅读时间需要3分钟。

    Azure ADAL库在Azure环境中如何实现身份验证?

    问题一:根据微软官方文档,2022年6月30日后,微软将不再对ADAL(包括ADAL.js、ADAL.NET、ADAL4J)提供任何技术支持。

    问题一:根据微软官方网站对ADAL(包含ADAL.js, ADAL.NET, ADAL4J)的声明​​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服务了?

    答案:包含在文档中的警告部分,​​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;
    });

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

    Azure ADAL库在Azure环境中如何实现身份验证?

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