Tag: azure active directory

升级到5.0.0后,TokenValidationParameters不再有效

我有以下代码,当我使用System.IdentityModel.Tokens.Jwt,版本= 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,它不再编译抱怨引用types“TokenValidationParameters”声明它定义在System.IdentityModel.Token.Jwt中,但它不能被发现。 另外,如果您尝试使用以下编译器,则会警告您Audience已过时 : 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,它开始编译。 是否对configurationAzure Active Directory进行了语法更改? 在Github上,我找不到使用最新的5.0.0包的单个项目,并且他们都使用之前的包4.0.20622.1351。 任何人都可以使用最新的System.IdentityModel.Tokens.Jwt 5.0.0揭示这一点,或者使用最新的包引导我到Github上的一些项目?

使用azure活动目录进行身份validation时,发生Azurepipe理库API调用时出错

我的公司正在研究关于Azure的报告。 我们只希望我们的客户给我们只读凭证供我们使用。 我做了一些研究,看起来Azure Active Directory就是这样做的。 所以我正在寻找使用只读的Azure目录应用程序进行身份validation。 为了让我开始,我正在关注这个使用Azure Active Directorypipe理API的博客。 https://msdn.microsoft.com/en-us/library/azure/dn722415.aspx 除了方法显示非常不友好,它不起作用=( 以全局pipe理员身份login后出现此错误: “AADSTS90014:请求主体必须包含以下参数:”client_secret或client_assertion“。 做了一些研究,发现这种authentication方式是原生应用程序,而不是networking应用程序(尽pipe博客文章说的其他明智..)。 所以我做了一个调整。 我的GetAuthorizationHeader现在看起来像这样: private static string GetAuthorizationHeader() { AuthenticationResult result = null; var context = new AuthenticationContext("https://login.windows.net/" + ConfigurationManager.AppSettings["tenantId"]); string clientId = ConfigurationManager.AppSettings["clientId"]; string clientSecret = ConfigurationManager.AppSettings["clientSecret"]; ClientCredential clientCred = new ClientCredential(clientId, clientSecret); var thread = new Thread(() => { result = […]