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

Saml2LogoutEvent not firing #209

Open nspaul opened 4 years ago

nspaul commented 4 years ago

I know this question has been raised before, but I've read through all of the previous issues and have not been able to understand my issue.

In short, the Saml2LogoutEvent is not firing. I do have the Saml2LoginEvent firing successfully, though, which the reason I am puzzled.

In EventServiceProvider.php, I have registered the two events by adding them to the $listen property:

use Aacotroneo\Saml2\Events\Saml2LoginEvent;
use Aacotroneo\Saml2\Events\Saml2LogoutEvent;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        Registered::class => [
            SendEmailVerificationNotification::class,
        ],
        'Aacotroneo\Saml2\Events\Saml2LoginEvent' => [
            'App\Listeners\LoginListener',
        ],
        'Aacotroneo\Saml2\Events\Saml2LogoutEvent' => [
            'App\Listeners\LogoutListener',
        ],
    ];
    ...

Then I generated the LoginListener and LogoutListener. My LoginListener gets fired and the handle() method works perfectly to get the user logged in. The LogoutListener does not get fired.

I'm happy to post more details here, but I'm curious what everyone here thinks. These two events seem so similar to each other, from a raw configuration standpoint, so how does the login event work and the logout event not work? I'm using Laravel 6.6.2 BTW.

ibovangeffen commented 4 years ago

Found my issue. I still had the default Laravel logout button way of processing a logout, meaning a button which submitted a form. After removing the form and using a normal anchor tag the SLS works. Perhaps you have the same issue?