public function OpenIDConnectSession::saveDestination in OpenID Connect / OAuth client 2.x
Same name and namespace in other branches
- 8 src/OpenIDConnectSession.php \Drupal\openid_connect\OpenIDConnectSession::saveDestination()
Save the current path and langcode, for redirecting after authorization.
Overrides OpenIDConnectSessionInterface::saveDestination
See also
\Drupal\openid_connect\Controller\OpenIDConnectRedirectController::authenticate()
File
- src/
OpenIDConnectSession.php, line 94
Class
- OpenIDConnectSession
- Session service of the OpenID Connect module.
Namespace
Drupal\openid_connectCode
public function saveDestination() {
// If the current request includes a 'destination' query parameter we'll use
// that in the redirection. Otherwise use the current request path and
// query.
$destination = ltrim($this->redirectDestination
->get(), '/');
$langcode = $this->languageManager
->getCurrentLanguage()
->getId();
// Don't redirect to user/login. In this case redirect to the user profile.
if (strpos($destination, ltrim(Url::fromRoute('user.login')
->toString(), '/')) === 0) {
$redirect_login = $this->configFactory
->get('openid_connect.settings')
->get('redirect_login');
$destination = $redirect_login ?: 'user';
}
$this->session
->set('openid_connect_destination', $destination);
$this->session
->set('openid_connect_langcode', $langcode);
}