问题描述
我有以下代码在我使用时有效 System.IdentityModel.Tokens.Jwt,版本= 4.0.20622.1351
I have the following code which was working when I was usingSystem.IdentityModel.Tokens.Jwt, Version=4.0.20622.1351
private static void ConfigureAzureAD(IAppBuilder appBuilder)
{
appBuilder.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters
{
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
}
});
}
但是,一旦我将此软件包升级到最新的软件包,即版本5 它不再编译抱怨对类型'TokenValidationParameters'的引用声称它在System.IdentityModel.Token.Jwt中定义,但找不到.
However as soon as I upgraded this package to the latest one which is version 5 it no longer compiles complainingReference to type 'TokenValidationParameters' claims it is defined in System.IdentityModel.Token.Jwt but it could not be found.
此外,如果您尝试使用以下编译器,则会警告您受众已过时:
Also if you try the following compiler will warn you that Audience is obsolete:
private static void ConfigureAzureAD(IAppBuilder appBuilder)
{
appBuilder.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
Audience = ConfigurationManager.AppSettings["ida:Audience"]
});
}
我再次降级了该DLL,并使用版本4.0.20622.1351,它开始编译.
I downgraded this DLL again and used the version 4.0.20622.1351, it started compiling.
配置Azure Active Directory是否进行了语法更改?
Has there been a syntax change for Configuring the Azure Active Directory?
在Github上,我找不到使用最新软件包5.0.0的单个项目,而所有项目都使用先前的软件包4.0.20622.1351.谁能使用最新的 System.IdentityModel.Tokens.Jwt 5.0.0 阐明这一点,还是可以使用最新的软件包将我定向到Github上的某个项目?
On Github I could not find a single project using the latest package 5.0.0 and all of them are using the previous package 4.0.20622.1351. Can anyone shed some light on this using the latest System.IdentityModel.Tokens.Jwt 5.0.0 or direct me to some project on Github using the latest package?
推荐答案
TokenValidationParameters在程序集中:Microsoft.IdentityModel.Tokens
TokenValidationParameters is in assembly: Microsoft.IdentityModel.Tokens
您似乎正在使用Katana(asp.net OWIN产品的第一个版本).武士刀(Katana)不支持5.0.0.您需要坚持使用4.x.
It looks like you are using Katana (the first version of asp.net OWIN offering).Katana does not support 5.0.0. You need to stick with 4.x.
最新版本的asp.net依赖于S.IM.xx和M.IM.xxx 5.0. https://github.com/aspnet
The latest version of asp.net takes a dependency on S.IM.xx and M.IM.xxx 5.0.https://github.com/aspnet
这篇关于升级到5.0.0后,TokenValidationParameters不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!