Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Mon 10862 allow to do not defined redirect url #10098

Merged
merged 14 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
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
14 changes: 12 additions & 2 deletions www/class/centreonAuth.SSO.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public function __construct(
&& !empty($this->ssoOptions['openid_connect_authorization_endpoint'])
&& !empty($this->ssoOptions['openid_connect_token_endpoint'])
&& !empty($this->ssoOptions['openid_connect_introspection_endpoint'])
&& !empty($this->ssoOptions['openid_connect_redirect_url'])
&& !empty($this->ssoOptions['openid_connect_client_id'])
&& !empty($this->ssoOptions['openid_connect_client_secret'])
) {
Expand All @@ -103,7 +102,18 @@ public function __construct(
# Get configured values
$clientId = $this->ssoOptions['openid_connect_client_id'];
$clientSecret = $this->ssoOptions['openid_connect_client_secret'];
$redirectNoEncode = $this->ssoOptions['openid_connect_redirect_url'];
if (empty($this->ssoOptions['openid_connect_redirect_url'])) {
$redirectNoEncode = '{scheme}://{hostname}:{port}'
. rtim($this->ssoOptions['oreon_web_path'], "/") . "/" . 'index.php';
} else {
$redirectNoEncode = $this->ssoOptions['openid_connect_redirect_url'];
}
$redirectSubstitutions = [
'{scheme}' => $_SERVER['REQUEST_SCHEME'],
'{hostname}' => $_SERVER['SERVER_NAME'],
'{port}' => $_SERVER['SERVER_PORT']
];
$redirectNoEncode = strtr($redirectNoEncode, $redirectSubstitutions);
$verifyPeer = $this->ssoOptions['openid_connect_verify_peer'];

# Build endpoint urls
Expand Down
3 changes: 2 additions & 1 deletion www/include/Administration/parameters/general/help.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
);
$help['openid_connect_redirect_url'] = dgettext(
'help',
'Your OpenId Connect redirect url (this server).'
'Your OpenId Connect redirect url (this server, {scheme}, {hostname} and {port} can be used for substitions,'
. ' default is {scheme}://{hostname}:{port}/your_centreon_path/index.php if left empty).'
);
$help['openid_connect_client_id'] = dgettext(
'help',
Expand Down