JOSE4J 是否会通过 OpenID Connect 发现文档支持 JWKS 密钥验证

Will JOSE4J Support JWKS key validation through the OpenID Connect discovery document

JOSE4J 将 jwks_uri 作为 JWT 验证的起点,我想知道是否可以支持发现文档作为起点,JOSE4J 会从那里获取 jwks_uri然后转到 JWKS 密钥文档以选择与 JWT 匹配的 public 密钥。这样我只需要在我的代码中对发现文档 uri 进行硬编码,因为我有点担心 jwks_uri 是否会在没有通知的情况下发生变化,据我所知,众所周知的发现文档是固定的。

现在是这样工作的:

    // 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 并相应地进行操作会更好。

谢谢!

一月

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