签名验证失败。无法匹配“孩子”
Posted
技术标签:
【中文标题】签名验证失败。无法匹配“孩子”【英文标题】:Signature validation failed. Unable to match 'kid' 【发布时间】:2018-02-19 08:54:08 【问题描述】:我使用 identityserver4 进行 SSO 问题是每当我重新启动 identityserver 客户端应用程序时,第一次出现异常消息时出现异常
发生了未处理的异常:未处理的远程故障。 (IDX10501:: 'e57439c26753f8a940888050ab3860fa', 令牌:'"alg":"RS256","typ":"JWT","kid":"e57439c26753f8a940888050ab3860fa"."nbf":1505114113,"exp":1505114413,"iss":"http://recruiterinsider-qa.wiseatom.com:85 “ ”澳元“: ”empite.rip“, ”随机数“: ”636407108987016790.OTIyYzNhOGYtZmY1OS00NDQyLThmNDUtYWNkOTA1NDEyM2JmYTlkYWRjNDMtNDRmMC00YmQxLWI2MGQtOTI2MDYzNDYxMTUy“, ”IAT“:1505114113, ”c_hash“: ”Bc0qZ4ezhn0-WB-e9rDp8g“, ”SID“: ”135b1b1f352674ab3b80846fef6ad0d8“,” 子":"94e570f7-920f-426e-b0db-e4f871323149","auth_time":1505114112,"idp":"local","amr":["pwd"]'.) System.AggregateException:未处理的远程故障。 (IDX10501: : 'e57439c26753f8a940888050ab3860fa',令牌: '"alg":"RS256","typ":"JWT","kid":"e57439c26753f8a940888050ab3860fa"."nbf":1505114113,"exp":1505114413,"iss":"http://recruiterinsider-qa.wiseatom.com:85", “AUD”: “empite.rip”, “随机数”: “636407108987016790.OTIyYzNhOGYtZmY1OS00NDQyLThmNDUtYWNkOTA1NDEyM2JmYTlkYWRjNDMtNDRmMC00YmQxLWI2MGQtOTI2MDYzNDYxMTUy”, “IAT”:1505114113, “c_hash”: “Bc0qZ4ezhn0-WB-e9rDp8g”, “SID”: “135b1b1f352674ab3b80846fef6ad0d8”, “子”: "94e570f7-920f-426e-b0db-e4f871323149","auth_time":1505114112,"idp":"local","amr":["pwd"]'.) ---> Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501:: 'e57439c26753f8a940888050ab3860fa',令牌: '"alg":"RS256","typ":"JWT","kid":"e57439c26753f8a940888050ab3860fa"."nbf":1505114113,"exp":1505114413,"iss":"http://recruiterinsider-qa.wiseatom.com:85", “AUD”: “empite.rip”, “随机数”: “636407108987016790.OTIyYzNhOGYtZmY1OS00NDQyLThmNDUtYWNkOTA1NDEyM2JmYTlkYWRjNDMtNDRmMC00YmQxLWI2MGQtOTI2MDYzNDYxMTUy”, “IAT”:1505114113, “c_hash”: “Bc0qZ4ezhn0-WB-e9rDp8g”, “SID”: “135b1b1f352674ab3b80846fef6ad0d8”, “子”: "94e570f7-920f-426e-b0db-e4f871323149","auth_time":1505114112,"idp":"local","amr":["pwd"]'。 在 System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(字符串 令牌,令牌验证参数验证参数)在 System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(字符串 令牌、TokenValidationParameters 验证参数、SecurityToken& 验证令牌)在 Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.ValidateToken(字符串 idToken、AuthenticationProperties 属性、 TokenValidationParameters 验证参数,JwtSecurityToken& jwt) 在 Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.d__20.MoveNext() --- 内部异常堆栈跟踪结束 --- 在 Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler
1.<HandleRemoteCallbackAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler
1.d__5.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)在 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.<HandleRequestAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware
1.d__18.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.d__18.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务)
所以我将AddTemporarySigningCredential
更改为AddDeveloperSigningCredential
仍然在我重新启动身份服务器时出现错误
如何解决这个问题?
【问题讨论】:
生产者和消费者使用相同的密钥材料?在 SO 上找到这个:***.com/questions/38239261/… 恐怕您真的需要帮助我们重现问题才能帮助您... 【参考方案1】:您的问题可能与此有关。检查official docs
在开发过程中,您有时可能会看到异常说明 无法验证令牌。这是因为 签名密钥材料是动态创建的,并且仅保存在内存中。 当客户端和 IdentityServer 退出时会发生此异常 同步。只需在客户端重复操作,下次 元数据已赶上,一切都应该再次正常工作。
【讨论】:
那么解决办法是什么?以上是关于签名验证失败。无法匹配“孩子”的主要内容,如果未能解决你的问题,请参考以下文章
每日获取 :: SecurityTokenSignatureKeyNotFoundException: IDX10501: 签名验证失败。无法匹配键:
收到 IDX10501 的错误信息:签名验证失败。使用 Azure AD 时无法匹配密钥