Skip to content

Conversation

@vrobert78
Copy link

@vrobert78 vrobert78 commented Sep 23, 2025

On Pimcore PaaS, we'd like to switch from running Mercure in a side app to running Mercure as a Service.
But running Mercure as a Service implies that we run it on a subdomain.
Those modifications are required for the authentication layer.

There are also changes required in studio-ui-bundle, see pimcore/studio-ui-bundle#2095.

@vrobert78
Copy link
Author

I replaced the cookieSameSite variable by jwt_cookie_strictness to have the same behavior as on Direct-Edit, see https://github.com/pimcore/direct-edit/pull/85/files.

Copy link
Contributor

@martineiber martineiber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!
I just have a small suggestion to improve readability.

@sonarqubecloud
Copy link

$tokenProvider: '@Pimcore\Bundle\StudioBackendBundle\Mercure\Service\ClientTokenService'
$cookieLifetime: '%pimcore_studio_backend.mercure_settings.cookie_lifetime%'
$cookieSameSite: '%pimcore_studio_backend.mercure_settings.cookie_same_site%'
$jwt_cookie_strictness: '%pimcore_studio_backend.mercure_settings.jwt_cookie_strictness%'
Copy link
Contributor

@kingjia90 kingjia90 Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$jwt_cookie_strictness: '%pimcore_studio_backend.mercure_settings.jwt_cookie_strictness%'
$jwtCookieStrictness: '%pimcore_studio_backend.mercure_settings.jwt_cookie_strictness%'

to keep camelCase as the others

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe even just $cookieStrictness, it's always JWT in this context

->info('Domain where to set the Mercure auth cookie, e.g. ".example.com".')
->defaultNull()
->end()
->booleanNode('jwt_cookie_strictness')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe as booleanNode might be not good if we have to consider SAMESITE_LAX use case too, might need a followup for https://github.com/pimcore/direct-edit/pull/85 in case

private UrlServiceInterface $urlService,
private int $cookieLifetime = 3600,
private string $cookieSameSite = Cookie::SAMESITE_STRICT,
private bool $jwt_cookie_strictness = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private bool $jwt_cookie_strictness = true,
private bool $jwtCookieStrictness = true,

true,
false,
$this->cookieSameSite
$this->jwt_cookie_strictness ? Cookie::SAMESITE_STRICT : Cookie::SAMESITE_NONE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->jwt_cookie_strictness ? Cookie::SAMESITE_STRICT : Cookie::SAMESITE_NONE
$this->jwtCookieStrictness ? Cookie::SAMESITE_STRICT : Cookie::SAMESITE_NONE

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