Open kalana3029 opened 4 years ago
You can use the authenticated user from the session :) Here's a simple Saml2Logout handler:
<?php
namespace App\Listeners;
use Aacotroneo\Saml2\Events\Saml2LogoutEvent;
class Saml2Logout
{
/**
* Handle the event.
*
* @param Saml2LogoutEvent $event
*
* @return void
*/
public function handle(Saml2LogoutEvent $event)
{
$user = auth()->user();
if ($user) {
\Log::info("User {$user->id} logged out")
}
auth()->logout();
session()->invalidate();
}
}
@danmichaelo Thing is, I am using token-based authentication. Can we get the logout user's email from the Saml2LogoutEvent ?
Hi, I need to identified the user which user was logout from the SAML, In SAMLLogoutEvent listener return only Idp name, How can i get the related user from there.