Add custom SAML attributes via Assertion event
masterBy default, the package sends ClaimTypes::EMAIL_ADDRESS (from auth()->user()->email) and ClaimTypes::GIVEN_NAME (from auth()->user()->name).
To send additional attributes, subscribe to the CodeGreenCreative\SamlIdp\Events\Assertion event in your EventServiceProvider and create a listener that interacts with the $event->attribute_statement.
// App ext
// In EventServiceProvider.php
protected $listen = [
'CodeGreenCreative\SamlIdp\Events\Assertion' => [
'App\Listeners\SamlAssertionAttributes',
]
];
// App
// In SamlAssertionAttributes.php
public function handle(Assertion $event)
{
$event->attribute_statement
->addAttribute(new Attribute(ClaimTypes::PPID, auth()->user()->id))
->addAttribute(new Attribute(ClaimTypes::NAME, auth()->user()->name));
}