OIDC签名验证 [英] OIDC signature verification

查看:86
本文介绍了OIDC签名验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在与商业客户一起测试我们自己的 OIDC-IDP.(我们无权访问客户端代码.)经过一些测试,客户端总是返回

We are testing our own OIDC-IDP with a commercial client. (We don't have access to the clients code.) After some tests, the client always returns

OpenID Connect 令牌验证失败:令牌签名无效 (ID_TOKEN)

OpenID Connect token validation failed: Token signature invalid (ID_TOKEN)

IDP 位于网络中,客户端位于我们自己的网络中,中间有一个 SSL 断路器.我们有一个测试客户端,也在 WWW 中,运行良好.

The IDP is in the wild of the web, the client is in our own network with a SSL breaker in between. We have a test client, also in the WWW, which works fine.

我的问题是,OIDC 客户端使用哪个证书来验证签名.是IDP网站的证书吗?如果是这样可能是这个错误的原因,ssl-breaker是否替换了原始证书?

My question is, which certificate does the OIDC-client use to verify the signature. Is it the certificate of the website of the IDP? If so could it be that the reason for this error, is the ssl-breaker replacing the original certificate?

推荐答案

关于 OIDC 术语的注意事项

  • OpenId Provider (OP) 类似于 SAML2 IdP
  • 依赖方 (RP) 类似于 SAML2 SP
  • 当您编写IdP"和客户端"时,我知道您指的是什么,但我想提一下,您通常会看到 OIDC 文档/讨论中使用的 OP 和 RP.

    I knew what you were referring to when you wrote "IdP" and "client", but I want to mention that you'll commonly see OP and RP used for OIDC documentation / discussions.

    您正在测试的商业 RP 声明 ID 令牌(即 JWT)的签名验证失败.要专门回答您的问题,不,不是使用来自 OP 网站的 x509 证书来验证签名.RP 用于验证签名的密钥将取决于您是否已将 OP 配置为使用以下方式签署 ID 令牌:

    The commercial RP you're testing with states that signature verification of the ID Token (i.e. JWT) is failing. To specifically answer your question, no, it is not using the x509 cert from the OP website to verify the signature. The key the RP uses to verify signature will depend on whether you've configured your OP to sign ID Tokens using:

    • HS256(对称密钥算法);或
    • RS256(非对称密钥算法)

    请查看此线程上已接受的答案以了解上下文:RS256 与 HS256:有何不同?

    Please have a look at the accepted answer on this thread for context: RS256 vs HS256: What's the difference?

    在前一种情况下 (HS256),您的 OP 使用密钥对 ID 令牌进行签名.并且您的 RP 必须使用相同的密钥验证签名.(注意:您可能知道,保持此共享密钥安全很重要.)如果这是您的环境,也许商业 RP 有一个配置选项,允许您上传或复制/粘贴密钥.

    In the former case (HS256), your OP signs the ID Token with a secret key. And your RP must verify the signature using that same secret key. (NB: as you probably know, it's important to keep this shared secret key safe and secure.) If this is your environment, perhaps the commercial RP has a configuration option that allows you to upload or copy/paste in the secret key.

    在后一种情况下 (RS256),您的 OP 使用私钥对 ID 令牌进行签名,但您的 RP 使用其对应的公钥来验证签名.如果这是您的环境,也许商业 RP 有一个配置选项来指定jwks_uri"和kid".这些分别是指您的公钥发布到的 URI 及其密钥 ID.

    In the latter case (RS256), your OP signs the ID Token with a private key, but your RP verifies the signature using its public key counterpart. If this is your environment, perhaps the commercial RP has a configuration option to specify "jwks_uri" and "kid". These refer to the URI that your public key is published to, and its key ID, respectively.

    这篇关于OIDC签名验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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