aacotroneo / laravel-saml2

A Laravel 5 package for Saml2 integration as a SP (service provider) based on the simple OneLogin toolkit
MIT License
567 stars 238 forks source link

SLS fire event but don't logout #214

Closed thebatclaudio closed 4 years ago

thebatclaudio commented 4 years ago

Hello, I have a problem with logout. When I logout from Application 1 I can see the Saml2LogoutEvent fired in Application 2. In my Application 2 LogoutListener there is a Auth::logout() (using Illuminate\Support\Facades\Auth), but when I load any protected page in Application 2, in my Auth middleware the user is still logged in!

The strange fact is that I tried to log Auth::user() in my LogoutListener, before Auth::logout() it's my logged in user, after logout it's null, so it seems that my user is logged out.

I don't understand what I'm doing wrong, can someone help me to fix this? Thank you

thebatclaudio commented 4 years ago

I resolved adding:

        session()->flush();
        session()->save();

After Auth::logout()