Skip to content
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

SSO Logout: Only works with general config sameSiteCookieValue('None') #207

Open
d--j opened this issue Jan 25, 2024 · 3 comments
Open

SSO Logout: Only works with general config sameSiteCookieValue('None') #207

d--j opened this issue Jan 25, 2024 · 3 comments
Assignees

Comments

@d--j
Copy link

d--j commented Jan 25, 2024

If one sets sameSiteCookieValue to anything other than None (including null – the default – in modern browsers see web.dev) SLO logout does not work.

Since the logout uses the session to store the SAML message ID, the SLO response will fail at this line https://github.com/flipboxfactory/saml-core/blob/d97a39bb23ef0b910b78c7f7463fb5e5b11164e9/src/controllers/messages/AbstractLogoutController.php#L73 . The SAML response will come from an external request so the session cookie will not be available for this action.

You might want to add this information to the documentation.

I only changed the session cookie sameSite via config/app.web.php:

return [
    'components' => [
        // The session cookie needs to be SameSite=None otherwise the SSO logout does not work
        'session' => function() {
            $config = craft\helpers\App::sessionConfig();
            $config['cookieParams']['sameSite'] = 'None';
            return Craft::createObject($config);
        },
    ],
];
@dsmrt dsmrt self-assigned this Jan 27, 2024
@dsmrt
Copy link
Contributor

dsmrt commented Jan 27, 2024

Thanks for the detailed and concise issue. This seems like a good thing to document like you recommended so thanks for sharing. I’m going to do some validation and update things here.

@dsmrt
Copy link
Contributor

dsmrt commented Feb 10, 2024

Hey @d--j ,

I'm actually not able to replicate this. Do I have this configured right to replicate what you're seeing?

Here is my config/app.php:

use craft\helpers\App;
return [
    'components' => [
        'session' => function() {
            $config = craft\helpers\App::sessionConfig();
            $config['cookieParams']['sameSite'] = 'None';
            return Craft::createObject($config);
        },
    ],
    'id' => App::env('CRAFT_APP_ID') ?: 'CraftCMS',
];

SLO is working for me as expected.

@dsmrt
Copy link
Contributor

dsmrt commented Feb 11, 2024

Also, I added a twig help for the logout url. See some docs here:
https://saml-sp.flipboxfactory.com/configure/logout.html#twig-logout-url-extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants