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 #82.

Signed-off-by: Frieder Schrempf <frieder.schrempf@online.de>
This commit is contained in:
Frieder Schrempf 2019-06-08 19:13:00 +02:00
parent 3f64725f26
commit 413c7a9239
No known key found for this signature in database
GPG Key ID: E7DD51F45F833802
3 changed files with 19 additions and 0 deletions

View File

@ -48,6 +48,12 @@ return [
'url' => '/saml/sls',
'verb' => 'GET',
],
[
'name' => 'SAML#singleLogoutService',
'url' => '/saml/sls',
'verb' => 'POST',
'postfix' => 'slspost',
],
[
'name' => 'SAML#notProvisioned',
'url' => '/saml/notProvisioned',

View File

@ -319,6 +319,13 @@ class SAMLController extends Controller {
public function singleLogoutService() {
$isFromGS = ($this->config->getSystemValue('gs.enabled', false) &&
$this->config->getSystemValue('gss.mode', '') === 'master');
// Some IDPs send the SLO request via POST, but OneLogin php-saml only handles GET.
// To hack around this issue we copy the request from _POST to _GET.
if(!empty($_POST['SAMLRequest'])) {
$_GET['SAMLRequest'] = $_POST['SAMLRequest'];
}
$isFromIDP = !$isFromGS && !empty($_GET['SAMLRequest']);
if($isFromIDP) {

View File

@ -54,6 +54,12 @@ class Test extends TestCase {
'url' => '/saml/sls',
'verb' => 'GET',
],
[
'name' => 'SAML#singleLogoutService',
'url' => '/saml/sls',
'verb' => 'POST',
'postfix' => 'slspost',
],
[
'name' => 'SAML#notProvisioned',
'url' => '/saml/notProvisioned',