Only show logout if SLO is set
Fixes https://github.com/nextcloud/user_saml/issues/10
This commit is contained in:
parent
906a1aba34
commit
77499230a2
|
@ -63,18 +63,12 @@ class SAMLSettings {
|
|||
'assertionConsumerService' => [
|
||||
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.assertionConsumerService'),
|
||||
],
|
||||
'singleLogoutService' => [
|
||||
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.singleLogoutService'),
|
||||
],
|
||||
],
|
||||
'idp' => [
|
||||
'entityId' => $this->config->getAppValue('user_saml', 'idp-entityId', ''),
|
||||
'singleSignOnService' => [
|
||||
'url' => $this->config->getAppValue('user_saml', 'idp-singleSignOnService.url', ''),
|
||||
],
|
||||
'singleLogoutService' => [
|
||||
'url' => $this->config->getAppValue('user_saml', 'idp-singleLogoutService.url', ''),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -93,8 +87,15 @@ class SAMLSettings {
|
|||
$settings['idp']['x509cert'] = $idpx509cert;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$slo = $this->config->getAppValue('user_saml', 'idp-singleLogoutService.url', '');
|
||||
if($slo !== '') {
|
||||
$settings['idp']['singleLogoutService'] = [
|
||||
'url' => $this->config->getAppValue('user_saml', 'idp-singleLogoutService.url', ''),
|
||||
];
|
||||
$settings['sp']['singleLogoutService'] = [
|
||||
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.singleLogoutService'),
|
||||
];
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,11 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
* @since 6.0.0
|
||||
*/
|
||||
public function getLogoutAttribute() {
|
||||
// FIXME: Detect if SLO is configured
|
||||
$slo = $this->config->getAppValue('user_saml', 'idp-singleLogoutService.url', '');
|
||||
if($slo === '') {
|
||||
return 'style="display:none;"';
|
||||
}
|
||||
|
||||
return 'href="'.$this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.singleLogoutService').'?requesttoken='.urlencode(\OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue()).'"';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue