I have the following code which was working when I was using System.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"]
}
});
}
However as soon as I upgraded this package to the latest one which is version 5 it no longer compiles complaining Reference 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"]
});
}
I downgraded this DLL again and used the version 4.0.20622.1351, it started compiling.
Has there been a syntax change for Configuring the Azure Active Directory?
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 is in assembly: Microsoft.IdentityModel.Tokens
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.
The latest version of asp.net takes a dependency on S.IM.xx and M.IM.xxx 5.0. https://github.com/aspnet