mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-05-01 08:44:53 +02:00
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' => [
|
'assertionConsumerService' => [
|
||||||
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.assertionConsumerService'),
|
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.assertionConsumerService'),
|
||||||
],
|
],
|
||||||
'singleLogoutService' => [
|
|
||||||
'url' => $this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.singleLogoutService'),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'idp' => [
|
'idp' => [
|
||||||
'entityId' => $this->config->getAppValue('user_saml', 'idp-entityId', ''),
|
'entityId' => $this->config->getAppValue('user_saml', 'idp-entityId', ''),
|
||||||
'singleSignOnService' => [
|
'singleSignOnService' => [
|
||||||
'url' => $this->config->getAppValue('user_saml', 'idp-singleSignOnService.url', ''),
|
'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;
|
$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;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,11 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
||||||
* @since 6.0.0
|
* @since 6.0.0
|
||||||
*/
|
*/
|
||||||
public function getLogoutAttribute() {
|
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()).'"';
|
return 'href="'.$this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.singleLogoutService').'?requesttoken='.urlencode(\OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue()).'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue