class LinkedinAuthManager in Social Auth LinkedIn 8
Same name and namespace in other branches
- 8.2 src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager
- 3.x src/LinkedInAuthManager.php \Drupal\social_auth_linkedin\LinkedInAuthManager
Manages the authentication requests.
Hierarchy
- class \Drupal\social_auth_linkedin\LinkedinAuthManager extends \Drupal\social_auth\AuthManager\OAuth2Manager
Expanded class hierarchy of LinkedinAuthManager
2 files declare their use of LinkedinAuthManager
- LinkedinAuthController.php in src/
Controller/ LinkedinAuthController.php - LinkedinAuthManagerTest.php in tests/
src/ Unit/ LinkedinAuthManagerTest.php
1 string reference to 'LinkedinAuthManager'
1 service uses LinkedinAuthManager
File
- src/
LinkedinAuthManager.php, line 11
Namespace
Drupal\social_auth_linkedinView source
class LinkedinAuthManager extends OAuth2Manager {
/**
* The request object.
*
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
/**
* The Linkedin service client.
*
* @var \LinkedIn\LinkedIn
*/
protected $client;
/**
* Code returned by Linkedin for authentication.
*
* @var string
*/
protected $code;
/**
* LinkedinLoginManager constructor.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request
* Used to get the parameter code returned by Linkedin.
*/
public function __construct(RequestStack $request) {
$this->request = $request
->getCurrentRequest();
}
/**
* {@inheritdoc}
*/
public function authenticate() {
$this->client
->setAccessToken($this
->getAccessToken());
return $this;
}
/**
* {@inheritdoc}
*/
public function getAccessToken() {
if (!$this->accessToken) {
$this->accessToken = $this->client
->getAccessToken($this
->getCode());
}
return $this->accessToken;
}
/**
* {@inheritdoc}
*/
public function getUserInfo() {
return $this->client
->get('/people/~:(id,first-name,last-name,email-address,picture-urls::(original))');
}
/**
* Gets the code returned by Linkedin to authenticate.
*
* @return string
* The code string returned by Linkedin.
*/
protected function getCode() {
if (!$this->code) {
$this->code = $this->request->query
->get('code');
}
return $this->code;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LinkedinAuthManager:: |
protected | property | The Linkedin service client. | |
LinkedinAuthManager:: |
protected | property | Code returned by Linkedin for authentication. | |
LinkedinAuthManager:: |
protected | property | The request object. | |
LinkedinAuthManager:: |
public | function | ||
LinkedinAuthManager:: |
public | function | ||
LinkedinAuthManager:: |
protected | function | Gets the code returned by Linkedin to authenticate. | |
LinkedinAuthManager:: |
public | function | ||
LinkedinAuthManager:: |
public | function | LinkedinLoginManager constructor. |