Symfony: on authentication with API Keys how do logout the current user (if already authenticated and not the same)?
<p>I have implemented <a href="http://symfony.com/doc/current/cookbook/security/api_key_authentication.html" rel="nofollow">API Key Authenticator</a> and works fine! But Symfony when the user is already authenticated don't call the pre-authentication mechanism.</p>

<p>It is possible perform the logout of the current user if it is already authenticated?</p>

<p>my security.yml</p>

<pre><code>security:
    encoders:
        ACME\FooBundle\Security\User\User: plaintext

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        chain_provider:
            chain:
                providers: [foo, bar]
        foo:
            id: foo_user_provider
        bar:
            id: bar_user_provider

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        secured_area:
             pattern: ^/
             anonymous: ~
             simple_preauth:
                provider: foo
                authenticator: apikey_authenticator
             form_login:
                 provider: chain_provider
                 remember_me: true
                 check_path: acme_foo_login_check
                 login_path: acme_foo_login
                 default_target_path:   acme_foo_homepage
                 target_path_parameter: _target_path
                 use_referer:           true
                 username_parameter: _username
                 password_parameter: _password
                 success_handler: ACME.security.login_success_handler
             logout:
                 path:   acme_foo_logout
                 target: acme_foo_login
                 invalidate_session: true
                 success_handler: ACME.security.logout_success_handler
             remember_me:
                 secret: '%secret%'
                 lifetime: 604800
                 path: /
                 domain: ~
                 remember_me_parameter: _remember_me
                 always_remember_me: false
                 httponly: false

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
        - { path: ^/admin, roles: ROLE_ADMIN}
</code></pre>