Skip to content

Feature Request: Allow inclusion of "jku" header in JWT #840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sopgreg opened this issue May 22, 2025 · 0 comments
Open

Feature Request: Allow inclusion of "jku" header in JWT #840

sopgreg opened this issue May 22, 2025 · 0 comments

Comments

@sopgreg
Copy link

sopgreg commented May 22, 2025

With a jku header present (JSON Web Key Set URL), a backend can always fetch the latest public keys for a kid for signature verification for the OpenID server. Otherwise, the public keys (which may rotate), need to be configured/hard coded into the backend and rotated appropriately.

A present jku header allows for manipulating and fake signing a JWT. It therefore must be used with caution in the backend and always be checked against a set of allowed URLs.

The Jose lib allows to includes this header via

com.nimbusds.jose.JWSHeader.Builder#jwkURL(URI jku)

There is no possibility though to configure this for

no.nav.security.mock.oauth2.token.OAuth2TokenProvider#jwsHeader

which is hardcoded like this and only includes the kid, typ and alg headers:

    private fun jwsHeader(
            keyId: String,
            type: String,
            algorithm: JWSAlgorithm,
        ): JWSHeader =
            JWSHeader
                .Builder(algorithm)
                .keyID(keyId)
                .type(JOSEObjectType(type))
                .build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant