public function SamlauthUserSyncEvent::isFirstLogin in SAML Authentication 4.x
Same name and namespace in other branches
- 8.3 src/Event/SamlauthUserSyncEvent.php \Drupal\samlauth\Event\SamlauthUserSyncEvent::isFirstLogin()
Indicates if the SAML login is happening for the first time.
This can mean that the user account is new, but also that an existing Drupal user (which may have logged in through other means) was just linked to the SAML provider. Note this is not an indicator of whether the Drupal user logged in for the first time.
There is no guarantee that the user or the link is already saved. (Specifically: if the user is being newly registered, it is not saved yet in practice. If an existing user was just linked, the authmap entry currently is likely already saved in the Drupal database but a future release will likely save the entry only after this event is dispatched.)
Return value
bool TRUE if the SAML login is happening for the first time.
File
- src/
Event/ SamlauthUserSyncEvent.php, line 96
Class
- SamlauthUserSyncEvent
- Wraps a samlauth user sync event for event listeners.
Namespace
Drupal\samlauth\EventCode
public function isFirstLogin() {
// For backward compatibility with code other than the samlauth module that
// decided to dispatch this event for some reason and is not passing
// $first_login yet, we'll also check if the account is new.
return $this->firstSamlLogin || $this->account
->isNew();
}