GithubHelp home page GithubHelp logo

Comments (2)

stanhu avatar stanhu commented on July 19, 2024

The issue here is that with the switch to #177, the jwt gem defaults to a key generator of JWT::JWK::KidAsKeyDigest instead of JWT::JWK::Thumbprint, which implements RFC 7638: https://www.rfc-editor.org/rfc/rfc7638.

It's not obvious that applications need to set the generator to make the kid values backwards compatible with json-jwt:

JWT.configuration.jwk.kid_generator_type = :rfc7638_thumbprint

This broke our application because we overrode Doorkeeper::OpenidConnect::DiscoveryController to export additional keys with RFC 7638 format via json-jwt, but Doorkeeper::OpenidConnect::IdToken uses a kid in the JWT::JWK::KidAsKeyDigest format. Clients would fail because the kid listed in the JWKS URL did not match the one provided in the token.

There is a json-jwt discussion to make RFC 7638 the default in a future version.

I think v1.8.x of this gem should default to the RFC7638 behavior:

diff --git a/lib/doorkeeper/openid_connect.rb b/lib/doorkeeper/openid_connect.rb
index b2bca97..d20642e 100644
--- a/lib/doorkeeper/openid_connect.rb
+++ b/lib/doorkeeper/openid_connect.rb
@@ -48,7 +48,7 @@ module Doorkeeper
         else
           OpenSSL::PKey.read(configuration.signing_key)
         end
-      ::JWT::JWK.new(key)
+      ::JWT::JWK.new(key, { kid_generator: JWT::JWK::Thumbprint })
     end
 
     def self.signing_key_normalized

I'm not sure if this needs to be customized. What do you think @nbulaj @kristof-mattei?

from doorkeeper-openid_connect.

stanhu avatar stanhu commented on July 19, 2024

#194 does this.

from doorkeeper-openid_connect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.