Skip to content

Commit

Permalink
authx - Support Joomla users+sessions - Prevent leaks among stateless…
Browse files Browse the repository at this point in the history
… requests
  • Loading branch information
totten committed Feb 26, 2021
1 parent 9f0bbe2 commit 234721a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/authx/Civi/Authx/Joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ public function logoutSession() {
* @inheritDoc
*/
public function loginStateless($userId) {
// Joomla CMSApplication always starts a session. It is impossible for any extension/plugin/component to influence this.
// See eg https://github.com/joomla/joomla-cms/issues/8772
// Our implementation here uses a simple (if ugly) mitigation to ensure that
// (1) all data is thread-local and (2) nothing is persisted from the request.

// I'm not aware of a more canonical solution. Since this tied-up with the `AbstractApplication` class
// hierarchy, perhaps one is supposed to make a new entry-point (`[cms.root]/components/com_civicrm/myapp.php`)?
// In any event, this work-around passes `AllFlowsTest::testMultipleStateless`.

\JFactory::getSession()->destroy();
\JFactory::getSession()->setHandler(new \CRM_Utils_FakeJoomlaSession('CIVISCRIPT'));
$user = new \JUser($userId);
$session = \JFactory::getSession();
Expand Down

0 comments on commit 234721a

Please sign in to comment.