Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ class QuantHubOpenidConnectRealm extends GenericOpenidConnectRealm implements Op
* {@inheritdoc}
*/
public function getLoginUrl($state, Url $redirect_url) {
$request = static::getRequest();
$query = [
'response_type' => 'code',
'scope' => $this->getScopeParameter(),
'client_id' => $this->getClientId(),
'state' => $state,
'redirect_uri' => $this->getRedirectUrl($redirect_url),
'ui_locales' => $this->languageManager->getCurrentLanguage()->getId(),
];
if ($request->query->has('idp_hint')) {
$query['kc_idp_hint'] = $request->query->get('idp_hint');
}
return Url::fromUri($this->getAuthorizationEndpoint(), [
'query' => [
'response_type' => 'code',
'scope' => $this->getScopeParameter(),
'client_id' => $this->getClientId(),
'state' => $state,
'redirect_uri' => $this->getRedirectUrl($redirect_url),
'ui_locales' => $this->languageManager->getCurrentLanguage()->getId(),
],
'query' => $query,
]);
}

Expand Down Expand Up @@ -274,4 +279,14 @@ protected function getRedirectUrl(?Url $url = NULL) {
return $url->setAbsolute()->toString();
}

/**
* Retrieves the currently active request object.
*
* @return \Symfony\Component\HttpFoundation\Request
* The currently active request object.
*/
protected static function getRequest() {
return \Drupal::request();
}

}