JOSE4J是否会通过OpenID Connect发现文档

时间:2017-06-07 23:18:31

标签: jwt jose4j jwk

JOSE4J将jwks_uri作为JWT验证的起点,我想知道是否可以支持Discovery Document作为起点,JOSE4J将从那里获取jwks_uri,然后转到JWKS密钥文档中选择通过小孩匹配JWT的公钥。这样我只需要在我的代码中对发现文档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并且相应地行为也许会很好。

谢谢!

1 个答案:

答案 0 :(得分:0)

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