SamlBundle icon indicating copy to clipboard operation
SamlBundle copied to clipboard

Logout user not working

Open andrius-kulbis opened this issue 11 years ago • 0 comments

I can't get the logout to work. When I click the logout button nothing happens.

If I check the var_dump($this->get('security.context')->getToken()) in my controller I get the following:

object(PDias\SamlBundle\Security\Authentication\Token\SamlUserToken)[60]
  private 'user' (Symfony\Component\Security\Core\Authentication\Token\AbstractToken) => 
    object(PDias\SamlBundle\Security\User\SamlUser)[59]
      private 'username' => string '[email protected]' (length=14)
      private 'roles' => 
        array (size=1)
          0 => 
            object(Symfony\Component\Security\Core\Role\Role)[58]
              ...
      private 'attributes' => 
        array (size=4)
          'mail' => 
            array (size=2)
              ...
          'cn' => string 'Kulbis Andrius' (length=14)
          'displayName' => string 'Kulbis Andrius' (length=14)
          'eduPersonPrincipalName' => string '[email protected]' (length=14)
  private 'roles' (Symfony\Component\Security\Core\Authentication\Token\AbstractToken) => 
    array (size=1)
      0 => 
        object(Symfony\Component\Security\Core\Role\Role)[58]
          private 'role' => string 'ROLE_USER' (length=9)
  private 'authenticated' (Symfony\Component\Security\Core\Authentication\Token\AbstractToken) => boolean true
  private 'attributes' (Symfony\Component\Security\Core\Authentication\Token\AbstractToken) => 
    array (size=0)
      empty

But if I add the var_dump($this->securityContext->getToken()) in Symfony\Component\Security\Http\Firewall\LogoutListener line 112 I always get null, on simple and logout request and that why the custom logoutHandler of PDias\SamlBundle\Security\Http\Logout\SamlLogoutHandler is not fired up.

Also I get two sess_ files in /var/lib/php5, one is empty and the other is with simplesaml session information

Why is the token null?

Maybe you can post working configuration of this bundle + simplesaml? Or the zip archive or something to get things going.

P.S. I have the following LogoutHandlers added to LogoutListener:

array (size=2)
  0 => 
    object(Symfony\Component\Security\Http\Logout\SessionLogoutHandler)[391]
  1 => 
    object(PDias\SamlBundle\Security\Http\Logout\SamlLogoutHandler)[390]
      protected 'serviceprovider' => string 'default-sp' (length=10)

andrius-kulbis avatar Dec 10 '14 08:12 andrius-kulbis