Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Logout handler won't be called when stateless is true. #5245

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

Closed
kayue opened this issue Aug 13, 2012 · 3 comments
Closed

Logout handler won't be called when stateless is true. #5245

kayue opened this issue Aug 13, 2012 · 3 comments

Comments

@kayue
Copy link

kayue commented Aug 13, 2012

   # Symfony/Component/Security/Http/Firewall/LogoutListener.php

    // handle multiple logout attempts gracefully
    if ($token = $this->securityContext->getToken()) {
        foreach ($this->handlers as $handler) {
            $handler->logout($request, $response, $token);
        }
    }

$token is null when stateless is true because ContextListener will not be added to listeners.

    # Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

    // Context serializer listener
    if (false === $firewall['stateless']) {
        $contextKey = $id;
        if (isset($firewall['context'])) {
            $contextKey = $firewall['context'];
        }

        $listeners[] = new Reference($this->createContextListener($container, $contextKey));
    }

Is this a desirable behavior?

@fabpot
Copy link
Member

fabpot commented Aug 13, 2012

This is probably desirable as when you are doing stateless authentication, well, there is no state, so nothing to do to logout.

@kayue
Copy link
Author

kayue commented Aug 13, 2012

I am working on a WordPress authentication bundle, the bundle use WordPress's cookie to check login state, thus I have enabled stateless authentication because no cookie should be created by Symfony (they are created by WordPress instead).

Am I doing anything wrong?

FYI my bundle is in https://github.com/101medialab/WordpressBundle

@kayue kayue closed this as completed Oct 20, 2012
@MatTheCat
Copy link
Contributor

Fixed by #24805

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

No branches or pull requests

3 participants