C# 如何让WindowsAzureActiveDirectoryBeareAuthenticationOptions接受带有星号的访问者

C# 如何让WindowsAzureActiveDirectoryBeareAuthenticationOptions接受带有星号的访问者,c#,owin,katana,adal,C#,Owin,Katana,Adal,My Azure Active Directory应用程序URI包含一个星号,类似于https://*.mywebapp.com“。 AAD可以成功获取https://test.mywebapp.com此应用程序的资源 在服务端,我使用OWIN和WindowsAzureActiveDirectoryBeareAuthenticationOptions验证令牌。 问题是不支持使用星号指定访问群体 对于以下代码,对于访问群体https://test.mywebapp.com app.UseWindo

My Azure Active Directory应用程序URI包含一个星号,类似于https://*.mywebapp.com“。 AAD可以成功获取
https://test.mywebapp.com
此应用程序的资源

在服务端,我使用OWIN和
WindowsAzureActiveDirectoryBeareAuthenticationOptions
验证令牌。 问题是不支持使用星号指定访问群体

对于以下代码,对于访问群体
https://test.mywebapp.com

app.UseWindowsAzureActiveDirectoryBearerAuthentication(
                new WindowsAzureActiveDirectoryBearerAuthenticationOptions
                {
                    Tenant = c_azureActiveDirectoryTenant,
                    TokenValidationParameters = new TokenValidationParameters
                    {
                        ValidAudiences = new[] { "https://*.mywebapp.com" },
                        SaveSigninToken = true,
                    },                       
                });

查看GitHub上的
AudienceValidator
IssuerValidator
代码,我可以很容易地理解原因-代码比较精确的字符串。我希望代码尊重通配符,这是出于设计还是仅仅是一个bug?有什么解决方法吗?

您可以通过设置TokenValidationParam来控制AudienceValidationeters.AudienceValidator委托。然后,您可以执行任何需要执行的操作