feat: add configurable session cache to cookie_session authenticator #1244
+349
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a configurable session cache to the
cookie_session
authenticator, reducing load on session stores and preventing rate limit errors during high traffic periods. The implementation aligns with the existing cache patterns used inoauth2_introspection
andoauth2_client_credentials
authenticators.Key Features
enabled
,ttl
, andmax_cost
settingsConfiguration Example
Benefits
Related issue(s)
Fixes #1167
Completes #1232
Checklist
introduces a new feature.
contributing code guidelines.
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.
works.
Further Comments
This PR completes the work started in #1232 by adding cache support to the
cookie_session
authenticator. The implementation follows the exact same patterns as the OAuth2 authenticators to ensure consistency across the codebase:authenticator_cookie_session_cache_test.go
)The default TTL was set to 1 second (instead of 60s) to balance the benefits of caching with the need for fresh session data in most use cases. Users can configure longer TTLs based on their specific requirements.