From 252122888cf29bd1404ff634e0d217629c1e4d6e Mon Sep 17 00:00:00 2001 From: Darren Poulson Date: Wed, 30 Nov 2022 23:48:48 +0000 Subject: [PATCH] Allow default COMMON_NAME field to be configurable --- config/samlidp.php | 2 ++ src/Events/Assertion.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/samlidp.php b/config/samlidp.php index 898891f..2958983 100644 --- a/config/samlidp.php +++ b/config/samlidp.php @@ -13,6 +13,8 @@ 'debug' => false, // Define the email address field name in the users table 'email_field' => 'email', + // Define the name field in the users table + 'name_field' => 'name', // The URI to your login page 'login_uri' => 'login', // Log out of the IdP after SLO diff --git a/src/Events/Assertion.php b/src/Events/Assertion.php index cedc9b1..cb1d43f 100644 --- a/src/Events/Assertion.php +++ b/src/Events/Assertion.php @@ -30,6 +30,6 @@ public function __construct(\LightSaml\Model\Assertion\AttributeStatement &$attr $this->attribute_statement = &$attribute_statement; $this->attribute_statement ->addAttribute(new Attribute(ClaimTypes::EMAIL_ADDRESS, auth($guard)->user()->__get(config('samlidp.email_field', 'email')))) - ->addAttribute(new Attribute(ClaimTypes::COMMON_NAME, auth($guard)->user()->name)); + ->addAttribute(new Attribute(ClaimTypes::COMMON_NAME, auth($guard)->user()->__get(config('samlidp.name_field', 'name')))); } }