You are here

public function SamlService::synchronizeUserAttributes in SAML Authentication 4.x

Same name and namespace in other branches
  1. 8.3 src/SamlService.php \Drupal\samlauth\SamlService::synchronizeUserAttributes()
  2. 8.2 src/SamlService.php \Drupal\samlauth\SamlService::synchronizeUserAttributes()

Synchronizes user data with attributes in the SAML request.

Parameters

\Drupal\user\UserInterface $account: The Drupal user to synchronize attributes into.

bool $skip_save: (optional) If TRUE, skip saving the user account.

bool $first_saml_login: (optional) Indicator of whether the account is newly registered/linked.

1 call to SamlService::synchronizeUserAttributes()
SamlService::doLogin in src/SamlService.php
Logs a user in, creating / linking an account; synchronizes attributes.

File

src/SamlService.php, line 749

Class

SamlService
Governs communication between the SAML toolkit and the IdP / login behavior.

Namespace

Drupal\samlauth

Code

public function synchronizeUserAttributes(UserInterface $account, $skip_save = FALSE, $first_saml_login = FALSE) {

  // Dispatch a user_sync event.
  $event = new SamlauthUserSyncEvent($account, $this
    ->getAttributes(), $first_saml_login);
  $this->eventDispatcher
    ->dispatch(SamlauthEvents::USER_SYNC, $event);
  if (!$skip_save && $event
    ->isAccountChanged()) {
    $account
      ->save();
  }
}