class SocialAuthUser in Social Auth 3.x
Same name and namespace in other branches
- 8.2 src/User/SocialAuthUser.php \Drupal\social_auth\User\SocialAuthUser
User data used for authentication with Drupal.
Hierarchy
- class \Drupal\social_auth\User\SocialAuthUser implements SocialAuthUserInterface
Expanded class hierarchy of SocialAuthUser
File
- src/
User/ SocialAuthUser.php, line 8
Namespace
Drupal\social_auth\UserView source
class SocialAuthUser implements SocialAuthUserInterface {
/**
* First name.
*
* @var string|null
*/
protected $firstName;
/**
* Last name.
*
* @var string|null
*/
protected $lastName;
/**
* Used to create the username in Drupal: first + last most of the time.
*
* @var string
*/
protected $name;
/**
* Email address.
*
* @var string|null
*/
protected $email;
/**
* ID in provider.
*
* @var string
*/
protected $providerUserID;
/**
* Token used for authentication in provider.
*
* @var string|mixed
*/
protected $token;
/**
* URL to get profile picture.
*
* @var string
*/
protected $pictureUrl = NULL;
/**
* Profile picture file.
*
* @var string|int|null
*/
protected $picture = NULL;
/**
* User's extra data. Store in additional_data field in social_auth entity.
*
* @var array|null
*/
protected $additionalData;
/**
* Other data added through external modules (e.g. event subscribers)
*
* @var array
*/
protected $customData;
/**
* User constructor.
*
* @param string $name
* The user's name.
* @param string $email
* The user's email address.
* @param string $provider_user_id
* The unique ID in provider.
* @param string $token
* The access token for making API calls.
* @param string|bool $picture_url
* The user's picture.
* @param array|null $additional_data
* The additional user data to be stored in database.
*/
public function __construct($name, $email, $provider_user_id, $token, $picture_url = NULL, $additional_data = NULL) {
$this->name = $name;
$this->email = $email;
$this->providerUserID = $provider_user_id;
$this->token = $token;
$this->pictureUrl = $picture_url;
$this->additionalData = $additional_data;
}
/**
* {@inheritdoc}
*/
public function getFirstName() {
return $this->firstName;
}
/**
* {@inheritdoc}
*/
public function setFirstName($first_name) {
$this->firstName = $first_name;
}
/**
* {@inheritdoc}
*/
public function getLastName() {
return $this->lastName;
}
/**
* {@inheritdoc}
*/
public function setLastName($last_name) {
$this->lastName = $last_name;
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this->name;
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this->name = $name;
}
/**
* {@inheritdoc}
*/
public function getEmail() {
return $this->email;
}
/**
* {@inheritdoc}
*/
public function setEmail($email) {
$this->email = $email;
}
/**
* {@inheritdoc}
*/
public function getProviderId() {
return $this->providerUserID;
}
/**
* {@inheritdoc}
*/
public function setProviderId($provider_id) {
$this->providerUserID = $provider_id;
}
/**
* {@inheritdoc}
*/
public function getToken() {
return $this->token;
}
/**
* {@inheritdoc}
*/
public function setToken($token) {
$this->token = $token;
}
/**
* {@inheritdoc}
*/
public function getPictureUrl() {
return $this->pictureUrl;
}
/**
* {@inheritdoc}
*/
public function setPictureUrl($picture_url) {
$this->pictureUrl = $picture_url;
}
/**
* {@inheritdoc}
*/
public function getPicture() {
return $this->picture;
}
/**
* {@inheritdoc}
*/
public function setPicture($file_id) {
$this->picture = $file_id;
}
/**
* {@inheritdoc}
*/
public function getAdditionalData() {
return $this->additionalData;
}
/**
* {@inheritdoc}
*/
public function setAdditionalData($additional_data) {
$this->additionalData = $additional_data;
}
/**
* {@inheritdoc}
*/
public function addData($key, $value) {
$this->customData[$key] = $value;
return $this;
}
/**
* {@inheritdoc}
*/
public function getData($key) {
return $this->customData[$key] ?? NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SocialAuthUser:: |
protected | property | User's extra data. Store in additional_data field in social_auth entity. | |
SocialAuthUser:: |
protected | property | Other data added through external modules (e.g. event subscribers) | |
SocialAuthUser:: |
protected | property | Email address. | |
SocialAuthUser:: |
protected | property | First name. | |
SocialAuthUser:: |
protected | property | Last name. | |
SocialAuthUser:: |
protected | property | Used to create the username in Drupal: first + last most of the time. | |
SocialAuthUser:: |
protected | property | Profile picture file. | |
SocialAuthUser:: |
protected | property | URL to get profile picture. | |
SocialAuthUser:: |
protected | property | ID in provider. | |
SocialAuthUser:: |
protected | property | Token used for authentication in provider. | |
SocialAuthUser:: |
public | function |
Adds a new key-value pair in customData. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Set the user's additional data. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets a value from customData. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's email. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's first name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's last name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's picture ID. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's picture URL. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's id in provider. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Gets the user's token. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's additional data. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's email. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's first name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's last name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's name. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's picture ID. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's picture URL. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's id in provider. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function |
Sets the user's token. Overrides SocialAuthUserInterface:: |
|
SocialAuthUser:: |
public | function | User constructor. |