class OpenIDConnectSession in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x src/OpenIDConnectSession.php \Drupal\openid_connect\OpenIDConnectSession
Session service of the OpenID Connect module.
Hierarchy
- class \Drupal\openid_connect\OpenIDConnectSession
Expanded class hierarchy of OpenIDConnectSession
3 files declare their use of OpenIDConnectSession
- OpenIDConnectAccountsForm.php in src/
Form/ OpenIDConnectAccountsForm.php - OpenIDConnectLoginForm.php in src/
Form/ OpenIDConnectLoginForm.php - OpenIdConnectSessionTest.php in tests/
src/ Unit/ OpenIdConnectSessionTest.php
1 string reference to 'OpenIDConnectSession'
1 service uses OpenIDConnectSession
File
- src/
OpenIDConnectSession.php, line 11
Namespace
Drupal\openid_connectView source
class OpenIDConnectSession {
/**
* The current path.
*
* @var \Drupal\Core\Path\CurrentPathStack
*/
protected $currentPath;
/**
* The request stack.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* Construct an instance of the OpenID Connect session service.
*
* @param \Drupal\Core\Path\CurrentPathStack $current_path
* The current path.
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
*/
public function __construct(CurrentPathStack $current_path, RequestStack $request_stack) {
$this->currentPath = $current_path;
$this->requestStack = $request_stack;
}
/**
* Save the current path in the session, for redirecting after authorization.
*
* @todo Evaluate, whether we can now use the user.private_tempstore instead
* of the global $_SESSION variable, as https://www.drupal.org/node/2743931
* has been applied to 8.5+ core.
*/
public function saveDestination() {
$current_path = $this->currentPath
->getPath();
$path = $current_path == '/user/login' ? '/user' : $current_path;
// The destination could contain query parameters. Ensure that they are
// preserved.
$query = $this->requestStack
->getCurrentRequest()
->getQueryString();
$_SESSION['openid_connect_destination'] = [
$path,
[
'query' => $query,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenIDConnectSession:: |
protected | property | The current path. | |
OpenIDConnectSession:: |
protected | property | The request stack. | |
OpenIDConnectSession:: |
public | function | Save the current path in the session, for redirecting after authorization. | |
OpenIDConnectSession:: |
public | function | Construct an instance of the OpenID Connect session service. |