Skip to content
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

Set IDTokenSigningAlgValuesSupported of DiscoveryConfiguration obtained by Discover when initializing RelyingParty. #574

Closed
1 of 2 tasks
otakakot opened this issue Mar 31, 2024 · 3 comments · Fixed by #579
Labels
auth enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed released

Comments

@otakakot
Copy link
Contributor

Preflight Checklist

  • I could not find a solution in the existing issues, docs, nor discussions
  • I have joined the ZITADEL chat

Describe your problem

When IDTokenVerifier is executed on a RelyingParty created with NewRelyingPartyOIDC, only RS256 is supported.

CheckSignature is performed on VerifyIDToken, but only RS256 is supported because supportedSigAlgs is always set to 0.

To solve this, specify WithSupportedSigningAlgorithms in the options argument of NewRelyingPartyOIDC.

To determine the value of WithSupportedSigningAlgorithms, create a DiscoveryConfiguration using the Discover method and specify IDTokenSigningAlgValuesSupported.

It is inefficient to use the Discover method twice with NewRelyingPartyOIDC and WithSupportedSigningAlgorithms.

Describe your ideal solution

Add the following processing in NewRelyingPartyOIDC.

	rp.verifierOpts = append(rp.verifierOpts, WithSupportedSigningAlgorithms(discoveryConfiguration.IDTokenSigningAlgValuesSupported...))

Version

v3.18.0

Additional Context

No response

@otakakot otakakot added the enhancement New feature or request label Mar 31, 2024
@muhlemmer muhlemmer added the auth label Apr 2, 2024
@muhlemmer
Copy link
Collaborator

Similar to #506 where duplicate calls are used for obtaining and setting PKCE config. I would want to propose a configuration option for the RP which will let it take the signing algorithms from the discovery call.

// WithSigningAlgsFromDiscovery appends the [WithSupportedSigningAlgorithms] option to the Verifier Options.
// The algorithms returned in the `id_token_signing_alg_values_supported` from the discovery response will be set.
func WithSigningAlgsFromDiscovery()

We are open for a PR.

@muhlemmer muhlemmer added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 3, 2024
@muhlemmer muhlemmer removed their assignment Apr 3, 2024
@otakakot
Copy link
Contributor Author

otakakot commented Apr 3, 2024

@muhlemmer

Thank you for your comment.
My revised proposal did not maintain public relations compatibility.
I will consider PR based on your revised proposal.

otakakot added a commit to otakakot/oidc that referenced this issue Apr 4, 2024
muhlemmer pushed a commit that referenced this issue Apr 16, 2024
…en_signing_alg_values_supported retrieved from DiscoveryEndpoint (#579)

* feat(rp): to use signing algorithms from discovery configuration (#574)

* feat: WithSigningAlgsFromDiscovery to verify IDTokenVerifier() behavior in RP with
Copy link

🎉 This issue has been resolved in version 3.22.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed released
Projects
Status: Done
2 participants