1 <?php namespace BookStack\Listeners;
3 use BookStack\Auth\Access\Saml2Service;
4 use Illuminate\Queue\InteractsWithQueue;
5 use Illuminate\Contracts\Queue\ShouldQueue;
6 use Aacotroneo\Saml2\Events\Saml2LoginEvent;
7 use Illuminate\Support\Facades\Log;
9 class Saml2LoginEventListener
14 * Create the event listener.
18 public function __construct(Saml2Service $saml)
26 * @param Saml2LoginEvent $event
29 public function handle(Saml2LoginEvent $event)
31 $messageId = $event->getSaml2Auth()->getLastMessageId();
32 // TODO: Add your own code preventing reuse of a $messageId to stop replay attacks
34 $samlUser = $event->getSaml2User();
36 $attrs = $samlUser->getAttributes();
37 $id = $samlUser->getUserId();
38 //$assertion = $user->getRawSamlAssertion()
40 $user = $this->saml->processLoginCallback($id, $attrs);