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

feat: cache OIDC providers #4222

Merged
merged 7 commits into from
Nov 27, 2024
Merged

feat: cache OIDC providers #4222

merged 7 commits into from
Nov 27, 2024

Conversation

zepatrik
Copy link
Member

This change significantly reduces the number of requests to /.well-known/openid-configuration endpoints.

Related issue(s)

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

This change significantly reduces the number of requests to `/.well-known/openid-configuration` endpoints.
@alnr
Copy link
Contributor

alnr commented Nov 25, 2024

IMO a general HTTP client cache would make more sense. It can be used in lots of places.

Based on https://github.com/gregjones/httpcache perhaps.

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.55%. Comparing base (e6d2d4d) to head (3461443).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
selfservice/strategy/oidc/strategy.go 86.66% 1 Missing and 1 partial ⚠️
selfservice/strategy/oidc/provider_microsoft.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4222      +/-   ##
==========================================
+ Coverage   78.52%   78.55%   +0.03%     
==========================================
  Files         380      380              
  Lines       27231    27262      +31     
==========================================
+ Hits        21383    21416      +33     
+ Misses       4224     4223       -1     
+ Partials     1624     1623       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alnr
Copy link
Contributor

alnr commented Nov 27, 2024

I don't understand this PR. Where is the caching?

@zepatrik
Copy link
Member Author

Where is the caching?

It's super hard to cache the full client responses correctly, so we added the cache to the go-oidc library instead. There we can do high-level caching.

@zepatrik zepatrik merged commit 30485c4 into master Nov 27, 2024
29 checks passed
@zepatrik zepatrik deleted the feat/oidc-provider-cache branch November 27, 2024 15:18
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

Successfully merging this pull request may close these issues.

3 participants