-
roderik β
committed 069c02c5 on 8.x-3.x
Issue #3308562: add more documentation about SamlauthEvents::USER_SYNC...
-
roderik β
committed 069c02c5 on 8.x-3.x
- π³π±Netherlands roderik Amsterdam,NL / Budapest,HU
I prefer forcing you to use the SamlauthEvents::USER_SYNC event. Unless you can convince me you really need the ExternalAuth Register event.
Advantages of SamlauthEvents::USER_SYNC:
- User accounts are saved only once / if you somehow see strange data in your attributes and you want to deny the user access, you can throw an exception without having your users polluted. (If you do this from the the ExternalAuth Register event, a user is already saved with partial data.)
- You have one place to do things with SAML attributes, and can use the same code (if applicable) regardless whether the user is newly registered.
In exchange for the above two points, you must:
- not save the account yourself, but call
$event->markAccountChanged()
, to prevent needless saves. - add a
if($event->getAccount()->isNew()
if you want to act only on newly registered users.
I've hopefully improved documentation to make clearer that this is also meant to be used during user registration.
I'll close this after a while if no feedback received.
- Status changed to Closed: works as designed
6 months ago 9:46pm 26 December 2023