在我使用identityserver4进行身份验证的应用程序中,我面临着这个异常:
SecurityTokenInvalidSignatureException: IDX10503:签名验证失败。尝试键:'Microsoft.IdentityModel.Tokens.RsaSecurityKey,KeyId:‘。例外情况:“”。{{“alg”:“RS256”,“RS256”:“JWT”}{“nbf”:1501510053,"exp":1501510353,"iss":"http://localhost:5000","aud":"clientId","iat":1501510053,"c_hash":"teGUAAIvU0EY9L1WzjfI2Q","sid":"c870b6184744290472b157ce5992f8e0",“c870b6184744290472b157ce5992f8e0”,"sub":"a3915666-8586-476b-9166-b5b183af609e","auth_time":1501508734,"idp":"local","amr":"pwd"}‘。
此时,我在身份服务器的凭据中没有一个证书可用于我的签名中。所以我尝试了这段代码,有时很有效,但我确信这是错误的。有人一步一步地使用SignInCredentials而没有.pfx证书?
var signinkey = new RsaSecurityKey(RSA.Create());
var signingCredentials = new SigningCredentials(signinkey,
SecurityAlgorithms.RsaSha256);
// Adds IdentityServer
services.AddIdentityServer()
.AddSigningCredential(signingCredentials)
...发布于 2017-07-31 17:54:02
使用
services.AddIdentityServer().AddDeveloperSigningCredential()
这将在第一次启动时创建一个随机RSA密钥对,并将其缓存在磁盘上。
https://stackoverflow.com/questions/45418387
复制相似问题