public function OpenIDConnectSession::saveDestination in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x src/OpenIDConnectSession.php \Drupal\openid_connect\OpenIDConnectSession::saveDestination()
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.
File
- src/
OpenIDConnectSession.php, line 50
Class
- OpenIDConnectSession
- Session service of the OpenID Connect module.
Namespace
Drupal\openid_connectCode
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,
],
];
}