【问题标题】:Will JOSE4J Support JWKS key validation through the OpenID Connect discovery documentJOSE4J 是否会通过 OpenID Connect 发现文档支持 JWKS 密钥验证
【发布时间】:2017-11-09 11:47:22
【问题描述】:

JOSE4J 以 jwks_uri 作为 JWT 验证的起点,我想知道是否可以支持 Discovery Document 作为起点,JOSE4J 会从那里获取 jwks_uri,然后去 JWKS 关键文档进行选择与 JWT 匹配的公钥通过孩子获得。这样我只需要在我的代码中硬编码发现文档 uri,因为我有点担心 jwks_uri 是否会在没有通知的情况下更改,据我所知,wellknow 发现文档是固定的。

现在是这样的:

    // The HttpsJwksVerificationKeyResolver uses JWKs obtained from the HttpsJwks and will select the
    // most appropriate one to use for verification based on the Key ID and other factors provided
    // in the header of the JWS/JWT.
    HttpsJwksVerificationKeyResolver httpsJwksKeyResolver = 
       new HttpsJwksVerificationKeyResolver(https_jwks);

也许让解析器识别是否传入发现文档 uri 并做出相应的行为会很好。

谢谢!

一月

【问题讨论】:

    标签: jwt jose4j jwk


    【解决方案1】:

    没有对它的直接支持,但您可以使用该逻辑实现自己的VerificationKeyResolver(可能在内部使用HttpsJwksVerificationKeyResolver)。或者应用程序代码可以(定期)从发现文档中提取 jwks_uri 值并使用它来创建HttpsJwksVerificationKeyResolver

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 2014-07-25
      • 2014-12-12
      • 2017-08-05
      • 1970-01-01
      • 2021-10-15
      • 2018-11-14
      • 1970-01-01
      • 2018-04-12
      相关资源
      最近更新 更多