IDX10501:签名验证失败。 Azure SSO WS联合会

时间:2019-06-22 01:11:08

标签: c# azure saml-2.0 claims-based-identity

我正在尝试将Azure设置为带有我们的应用程序的联合登录的身份提供者。看来应该足够简单了,但是...

代码:

private void ConfigureSAML2()
    {
        Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;

        App.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
        App.UseCookieAuthentication(new CookieAuthenticationOptions());

        App.UseWsFederationAuthentication(
            new WsFederationAuthenticationOptions
            {
                Wtrealm = "75d8479b-5530-4e93-a685-fc0d6847c453",
                MetadataAddress = "https://login.microsoftonline.com/17ea2b4e-7ce9-4eb4-9d1a-6d7da51f1421/federationmetadata/2007-06/federationmetadata.xml",
                Notifications = new WsFederationAuthenticationNotifications
                {
                    AuthenticationFailed = context =>
                    {
                        context.HandleResponse();
                        context.Response.Redirect(ConfigurationService.BaseURL + "#/authentication?failed=true&message=" + context.Exception.Message);
                        return Task.FromResult(0);
                    }
                }
            });
    }

不幸的是,它始终通过Exception.Message =“ IDX10501:签名验证失败。无法匹配密钥来触发失败。kid:'Microsoft.IdentityModel.Xml.KeyInfo',令牌:'Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityToken '。”和Exception.StackTrace =

  Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ValidateSignature(String token,TokenValidationParametersvalidationParameters)中的

     在Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ValidateToken(字符串令牌,TokenValidationParametersvalidationParameters,SecurityToken&validatedToken)      在Microsoft.Owin.Security.WsFederation.WsFederationAuthenticationHandler.d__8.MoveNext()

古怪的是,当我看到Azure向我发送的索赔看起来合法时。我可以看到我的名字,姓氏,电子邮件等完整无缺。我很想粉碎并从响应中获取我需要的东西,但我更希望使中间件正常工作。

我认为我的Wtrealm值看起来很奇怪,但这是Azure知道我在说什么的唯一方式。我很难找到许多带有Azure的WS-Federation的示例。不幸的是,OpenId Connect不是我们的选择(顺便说一句,我们已经可以使用了。)

0 个答案:

没有答案
相关问题