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

fix(client/rs): do not error when issuer discovery has no introspection endpoint #414

Merged
merged 2 commits into from
Jun 23, 2023
Merged

fix(client/rs): do not error when issuer discovery has no introspection endpoint #414

merged 2 commits into from
Jun 23, 2023

Conversation

hhromic
Copy link
Contributor

@hhromic hhromic commented Jun 22, 2023

This PR fixes client/rs to not error when an issuer discovery returns no introspection endpoint.

Summary of changes:

  • newResourceServer() will only fill rs.tokenURL and rs.introspectURL if they were not given as static endpoints using WithStaticEndpoints(). This allows the discovery mechanism to always respect the user-provided static endpoints and only fill them when one or the other was not statically provided. Also, given that config.introspectURL is optional in the OIDC Discovery spec, it is no longer enforced to be present after discovery.
  • Introspect() will now fail if the passed ResourceServer does not have an IntrospectionURL() set. This allows for graceful errors in case issuers do not provide an introspection endpoint.
  • Added unit tests covering all situations using discovery and static endpoints.

Fixes #413

Definition of Ready

  • I am happy with the code
  • Short description of the feature/issue is added in the pr description
  • PR is linked to the corresponding user story
  • Acceptance criteria are met
  • All open todos and follow ups are defined in a new ticket and justified
  • Deviations from the acceptance criteria and design are agreed with the PO and documented.
  • No debug or dead code
  • My code has no repetitions
  • Critical parts are tested automatically
  • Where possible E2E tests are implemented
  • Documentation/examples are up-to-date
  • All non-functional requirements are met
  • Functionality of the acceptance criteria is checked manually on the dev system.

Copy link
Collaborator

@muhlemmer muhlemmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this excellent contribution and tests!

@muhlemmer muhlemmer enabled auto-merge (squash) June 23, 2023 07:17
@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #414 (974bdcb) into main (9e62498) will increase coverage by 0.40%.
The diff coverage is 81.81%.

@@            Coverage Diff             @@
##             main     #414      +/-   ##
==========================================
+ Coverage   52.28%   52.69%   +0.40%     
==========================================
  Files          74       74              
  Lines        5711     5718       +7     
==========================================
+ Hits         2986     3013      +27     
+ Misses       2461     2445      -16     
+ Partials      264      260       -4     
Impacted Files Coverage Δ
pkg/client/rs/resource_server.go 53.08% <81.81%> (+23.35%) ⬆️

... and 2 files with indirect coverage changes

@muhlemmer muhlemmer merged commit 406153a into zitadel:main Jun 23, 2023
8 checks passed
@github-actions
Copy link

🎉 This PR is included in version 2.6.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@muhlemmer
Copy link
Collaborator

@hhromic if you are interested, you can get some contributor swag through this google form: https://docs.google.com/forms/d/e/1FAIpQLSc-8t4G7HHCnxLKdGR7F3vLtKu31f7K4fdlqW4j0cirMYPUEA/viewform

@hhromic hhromic deleted the fix-rs-discovery branch June 26, 2023 10:01
@hhromic
Copy link
Contributor Author

hhromic commented Jun 26, 2023

@muhlemmer thanks for the kind offer and very nice to see your company supports open source in such a great way!
For the moment I'm good, this was a very small contribution hehe. Perhaps next time! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

client/rs: error when issuer discovery has no introspection endpoint
2 participants