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

Skip to content

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

Closed
@kayue

Description

@kayue
   # 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions