Skip to content

Commit 6efb743

Browse files
committed
Handle SLO logout requests from IdP via POST
Some IdPs send their SLO logout requests via POST. To handle them we need to add an entry in the routing table. Further, we need to hack around the issue, that php-saml only handles GET by copying the request from $_POST to $_GET. This solves nextcloud#82. Signed-off-by: Frieder Schrempf <fr.sc@online.de>
1 parent f780006 commit 6efb743

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

appinfo/routes.php

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
'url' => '/saml/sls',
4949
'verb' => 'GET',
5050
],
51+
[
52+
'name' => 'SAML#singleLogoutService',
53+
'url' => '/saml/sls',
54+
'verb' => 'POST',
55+
'postfix' => 'slopost',
56+
],
5157
[
5258
'name' => 'SAML#notProvisioned',
5359
'url' => '/saml/notProvisioned',

lib/Controller/SAMLController.php

+7
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,13 @@ public function assertionConsumerService() {
319319
public function singleLogoutService() {
320320
$isFromGS = ($this->config->getSystemValue('gs.enabled', false) &&
321321
$this->config->getSystemValue('gss.mode', '') === 'master');
322+
323+
// Some IDPs send the SLO request via POST, but OneLogin php-saml only handles GET.
324+
// To hack around this issue we copy the request from _POST to _GET.
325+
if(!empty($_POST['SAMLRequest'])) {
326+
$_GET['SAMLRequest'] = $_POST['SAMLRequest'];
327+
}
328+
322329
$isFromIDP = !$isFromGS && !empty($_GET['SAMLRequest']);
323330

324331
if($isFromIDP) {

0 commit comments

Comments
 (0)