Skip to content

Commit 6483079

Browse files
shawnhooperShawn Hooper
andauthored
Get E-Mail from field defined in the config (#53)
Co-authored-by: Shawn Hooper <shawn@actionablebooks.com>
1 parent 5e11b6a commit 6483079

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Events/Assertion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(\LightSaml\Model\Assertion\AttributeStatement &$attr
2929
{
3030
$this->attribute_statement = &$attribute_statement;
3131
$this->attribute_statement
32-
->addAttribute(new Attribute(ClaimTypes::EMAIL_ADDRESS, auth()->user()->email))
32+
->addAttribute(new Attribute(ClaimTypes::EMAIL_ADDRESS, auth()->user()->__get(config('samlidp.email_field', 'email'))))
3333
->addAttribute(new Attribute(ClaimTypes::COMMON_NAME, auth()->user()->name));
3434
}
3535
}

src/Jobs/SamlSso.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function response()
8181
->setSignature(new SignatureWriter($this->certificate, $this->private_key))
8282
->setSubject(
8383
(new Subject)
84-
->setNameID((new NameID(auth()->user()->email, SamlConstants::NAME_ID_FORMAT_EMAIL)))
84+
->setNameID((new NameID(auth()->user()->__get(config('samlidp.email_field', 'email')), SamlConstants::NAME_ID_FORMAT_EMAIL)))
8585
->addSubjectConfirmation(
8686
(new SubjectConfirmation)
8787
->setMethod(SamlConstants::CONFIRMATION_METHOD_BEARER)

0 commit comments

Comments
 (0)