From e0f93b2673d18c1dcf211c186b7deac6c14b1f81 Mon Sep 17 00:00:00 2001 From: darynmitchell Date: Mon, 22 Mar 2021 14:08:35 +0300 Subject: [PATCH 1/2] Add SignedIn event accessors, to match docs The [library readme](https://github.com/24Slides/laravel-saml2/blob/master/README.md) gives code examples of handling authentication events, including `$event->getAuth()` and `$event->getSame2User()`. Before this commit, that example code will fail because those accessors don't exist. This commit adds those accessors to match the readme code example. --- src/Events/SignedIn.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Events/SignedIn.php b/src/Events/SignedIn.php index 515ae4d..3b04128 100644 --- a/src/Events/SignedIn.php +++ b/src/Events/SignedIn.php @@ -37,4 +37,26 @@ public function __construct(Saml2User $user, Auth $auth) $this->user = $user; $this->auth = $auth; } + + /** + * Get the authentication handler for a SAML sign in attempt + * + * @return Auth The authentication handler for the SignedIn event + */ + public function getAuth(): Auth + { + return $this->auth; + } + + /** + * Get the user represented in the SAML sign in attempt + * + * @return Saml2User The user for the SignedIn event + */ + public function getSaml2User(): Saml2User + { + $this->user = $user; + $this->auth = $auth; + return $this->user; + } } From d6523b1ecebae107ee735d90eec010b3f9b55a6d Mon Sep 17 00:00:00 2001 From: darynmitchell Date: Mon, 22 Mar 2021 14:20:23 +0300 Subject: [PATCH 2/2] remove mis-pasted lines --- src/Events/SignedIn.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Events/SignedIn.php b/src/Events/SignedIn.php index 3b04128..fef1891 100644 --- a/src/Events/SignedIn.php +++ b/src/Events/SignedIn.php @@ -55,8 +55,6 @@ public function getAuth(): Auth */ public function getSaml2User(): Saml2User { - $this->user = $user; - $this->auth = $auth; return $this->user; } }