我正在尝试在我的IdentityServer3实现中添加WsFederationAuthenticationOption作为外部身份验证提供程序。我正在使用Microsoft.Owin.Security.WsFedrataion NuGet Package。并将其添加为外部Idenity Provider,如下所示
public static void ConfigureAdditionalIdentityProviders(IAppBuilder app, string signInAsType)
{
var adfs = new WsFederationAuthenticationOptions
{
AuthenticationType = "adfs",
Caption = "TEST ADFS",
SignInAsAuthenticationType = signInAsType,
MetadataAddress =
"https://adfs.myurl.com/federationmetadata/200706/federationmetadata.xml",
Wtrealm = "urn:myApp"
};
app.UseWsFederationAuthentication(adfs);
}
在身份验证选项设置
var authenticationOptions = new AuthenticationOptions()
{
RememberLastUsername = true,
CookieOptions = cookieOptions,
EnableLocalLogin = true,
EnableLoginHint = true,
EnablePostSignOutAutoRedirect = true,
EnableSignOutPrompt = true,
InvalidSignInRedirectUrl =
"https://www.myapp.io/",
PostSignOutAutoRedirectDelay = 0,
SignInMessageThreshold = 100,
IdentityProviders = ConfigureAdditionalIdentityProviders,
};
它将我重定向到右ADFS服务器并显示屏幕以填写我的ADFS登录详细信息。并且在成功登录后,它返回到我的情况下的IdentityServer的核心URL,如https://myIdentityserver.com/Core等
但我在日志中遇到以下错误。
来自Owin Middleware的异常Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException:IDX10503:签名验证失败。键尝试:'[PII默认隐藏。将IdentityModelEventSource.cs中的'ShowPII'标志设置为true以显示它。]'。捕获的例外情况:'[PII默认隐藏。将IdentityModelEventSource.cs中的'ShowPII'标志设置为true以显示它。]'。令牌:'[PII默认隐藏。将IdentityModelEventSource.cs中的'ShowPII'标志设置为true以显示它。]'。
我试图找到设置ShowPII标志的方法,但没有得到Identityserver文档的任何帮助,我也尝试将requiredSSl选项更改为false。但它没有帮助。
请分享你的想法。我在这里失踪了什么。
谢谢
这已经解决了。感谢Pilotbob的以下帖子
IDX10503: Signature validation failed after updating to Owin.Security v 4.0.0
问题是最新版本的Microsoft.Owin.Security.WsFederation不支持SHA-1,ADFS端的信赖方信任设置应至少具有SHA-256。
谢谢。