Problem/Motivation

It would be nice to have the SAML Attributes available in the ExternalAuth Register event. This makes it possible to alter some data on the account based on the SAML Attributes.

Proposed resolution

Pass on SAML Attributes to the ExternalAuth::register method.

CommentFileSizeAuthor
#4 3308562-4.patch723 bytesAnonymous (not verified)
#3 3308562-2.patch890 bytesAnonymous (not verified)
#2 3308562-1.patch852 bytesAnonymous (not verified)

Comments

Anonymous’s picture

dfernandez1991 created an issue. See original summary.

Anonymous’s picture

StatusFileSize
new852 bytes
Anonymous’s picture

StatusFileSize
new890 bytes
Anonymous’s picture

StatusFileSize
new723 bytes
Anonymous’s picture

Status: Active » Needs review
john franklin’s picture

+1 this patch.

  • roderik committed 069c02c5 on 8.x-3.x
    Issue #3308562: add more documentation about SamlauthEvents::USER_SYNC...
roderik’s picture

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 edit: that call isn't required for newly registered accounts because those are always saved
  • 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.

roderik’s picture

roderik’s picture

Status: Needs review » Closed (works as designed)