feat(openid-connect): update session config to support lua-resty-session, fixes deprecated session.cookie.lifetime#13178
Open
francescodedomenico wants to merge 3 commits intoapache:masterfrom
Conversation
4.x Replace the deprecated `session.cookie.lifetime` property with the full set of lua-resty-session 4.x configuration options: cookie settings (cookie_name, cookie_path, cookie_domain, cookie_same_site, etc.), timeout controls (idling_timeout, rolling_timeout, absolute_timeout), remember/persistent session support, and additional options like audience, hash_storage_key, and store_metadata. BREAKING CHANGE: `session.cookie.lifetime` has been removed. Use `idling_timeout`, `rolling_timeout`, and `absolute_timeout` instead.
Contributor
|
Hi @francescodedomenico, thank you for your contribution, but we need to evaluate whether it’s necessary to expose all the underlying library’s configurations. I’ll discuss this with the other maintainers. I look forward to hearing others’ thoughts. |
idling_timeout, updated plugin configuration in openid-connect.t to reflect new config schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
APISIX bundles
lua-resty-session 4.1.5, but theopenid-connectplugin's session schema still exposed the legacysession.cookie.lifetimeproperty from the 3.x API. Sincelua-resty-openidcpasses the session configuration as-is toresty.session.start(), only properties recognized by the 4.x library actually take effect.This PR removes the deprecated
session.cookie.lifetimeand replaces it with the full set of flat configuration keys thatlua-resty-session4.x supports.Why does it matter
With this update we have full control of the oidc sticky session, allowing apisix users to
New session properties
cookie_name,cookie_prefix,cookie_path,cookie_domain,cookie_http_only,cookie_secure,cookie_priority,cookie_same_site,cookie_same_party,cookie_partitionedidling_timeout(default 900s),rolling_timeout(default 3600s),absolute_timeout(default 86400s)remember,remember_cookie_name,remember_rolling_timeout,remember_absolute_timeout,remember_safetyaudience,subject,enforce_same_subject,stale_ttl,touch_threshold,compression_threshold,hash_storage_key,hash_subject,store_metadataMigration from
session.cookie.lifetimeThe old
session.cookie.lifetime(default 3600s) mapped loosely to a single cookie expiry. Inlua-resty-session4.x this is replaced by three independent timeouts that give much finer-grained control:session.cookie.lifetimeidling_timeout— invalidate after inactivityrolling_timeout— force renewal after durationabsolute_timeout— hard session max lifetimeBreaking change
Please note that even if I am mentioning this as a breaking change, the
session.cookie.lifetimeis already ignored by the resty.session plugin in APISIX main branch and 3.15 release, possibly happening on older versions as wellsession.cookie.lifetimeis no longer accepted. Existing configurations using this property will be rejected by schema validation (additionalProperties = false). Users should migrate toidling_timeout,rolling_timeout, and/orabsolute_timeout.Files changed
apisix/plugins/openid-connect.lua— replaced session schema withlua-resty-session4.x propertiesdocs/en/latest/plugins/openid-connect.md— updated English documentationdocs/zh/latest/plugins/openid-connect.md— updated Chinese documentationt/plugin/openid-connect10.t— 14 new schema validation tests covering valid configs, invalid enum/type values, deprecated property rejection, and unknown property rejectionWhich issue(s) this PR fixes:
Fixes #13177
Checklist