-
Notifications
You must be signed in to change notification settings - Fork 105
fix: Wire up Device Storage Method session setting to SDK configuration #947
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
base: 5.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
|
|
||
| use Auth0\SDK\Auth0; | ||
| use Auth0\SDK\Configuration\SdkConfiguration; | ||
| use Auth0\SDK\Store\SessionStore; | ||
| use Auth0\WordPress\Actions\{Authentication as AuthenticationActions, Base as Actions, Configuration as ConfigurationActions, Sync as SyncActions, Tools as ToolsActions, Updates as UpdatesActions}; | ||
| use Auth0\WordPress\Cache\WpObjectCachePool; | ||
| use Auth0\WordPress\Filters\{Authentication as AuthenticationFilters, Base as Filters}; | ||
|
|
@@ -319,6 +320,10 @@ private function importConfiguration(): SdkConfiguration | |
| ); | ||
| } | ||
|
|
||
| if ('sessions' === $this->getOptionString('sessions', 'method')) { | ||
|
kishore7snehil marked this conversation as resolved.
|
||
| $sdkConfiguration->setSessionStorage(new SessionStore($sdkConfiguration, $sdkConfiguration->getSessionStorageId())); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SessionStore also doesn't call
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's exactly what happens. Visiting an AJAX-heavy page in the admin causes my local environment to crash with ERR_CONNECTION_REFUSED errors, requiring a server restart. My local dev uses PHP's default file-based session handler, which is where the locking is most severe. Hosts using Redis or database-backed sessions would fare better, but it does highlight wider issues with the SessionStore approach as-is.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since PHP's default file-based session handler is what most self-hosted WordPress installations use, and you've confirmed it causes server crashes on AJAX-heavy admin pages, I don't think we should ship this without at least warning admins at runtime.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add an admin notice when "PHP Native Sessions" is selected? Something along the lines of:
This way we're not blocking the feature, but we're making sure admins don't hit the locking wall without any heads-up beyond the existing generic warning. |
||
| } | ||
|
|
||
| if ('disable' !== $caching) { | ||
| $wpObjectCachePool = new WpObjectCachePool(); | ||
| $sdkConfiguration->setTokenCache($wpObjectCachePool); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.