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')))); } }