身份服务器 4 - IDX10630:PII 已隐藏 [英] Identity Server 4 - IDX10630: PII is hidden

查看:63
本文介绍了身份服务器 4 - IDX10630:PII 已隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用加密和 rsa 令牌还很陌生,我试图让 IDentityServer4 不使用开发人员签名,而是使用我自己的签名.这是我迄今为止尝试过的:

I'm fairly new to using encryption and rsa tokens and I'm trying to get IDentityServer4 to not use the developersigning, but one of my own. Here is what I have tried so far:

var keyInfo = new RSACryptoServiceProvider().ExportParameters(true);
var rsaSecurityKey = new RsaSecurityKey(new RSAParameters
{
    D = keyInfo.D,
    DP = keyInfo.DP,
    DQ = keyInfo.DQ,
    Exponent = keyInfo.Exponent,
    InverseQ = keyInfo.InverseQ,
    Modulus = keyInfo.Modulus,
    P = keyInfo.P,
    Q = keyInfo.Q
});

services.AddIdentityServer()
.AddSigningCredential(rsaSecurityKey)
.AddInMemoryPersistedGrants()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddAspNetIdentity<User>();

但是,当我运行 Identity Server4 并被重定向到另一个网站的登录页面时,我收到以下错误:

However, when I run Identity Server4 and I get redirected to sign in page from another website, I get the following error:

IDX10630:用于签名的[PII is hidden]"不能小于[PII is hidden]"位.KeySize: '[PII 被隐藏]'.参数名称:key.KeySize

IDX10630: The '[PII is hidden]' for signing cannot be smaller than '[PII is hidden]' bits. KeySize: '[PII is hidden]'. Parameter name: key.KeySize

我不得不承认,我整个周末都在努力研究如何使用 SigningCredentials,但我不确定我在上面做错了什么.

I have to admit, I've been on this all weekend, trying to figure out how to use SigningCredentials and I'm not really sure what I've done wrong above.

推荐答案

您可以通过在 Startup 类的 Configure() 中添加以下内容来查看更多开发细节:

You can see more details in development by adding the following to Configure() in the Startup class:

if (env.IsDevelopment())
{
     IdentityModelEventSource.ShowPII = true; 
}

这篇关于身份服务器 4 - IDX10630:PII 已隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆