From 1d4f7281053b1ce560d10c7d4a1ac31b2e156ba1 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 11 Aug 2009 14:15:17 +0000 Subject: [PATCH] SAML2_Binding: Check for request parameters when detecting the binding. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1646 44740490-163a-0410-bde0-09ae8108e29a --- lib/SAML2/Binding.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/SAML2/Binding.php b/lib/SAML2/Binding.php index 957ec4d73..0dc960c42 100644 --- a/lib/SAML2/Binding.php +++ b/lib/SAML2/Binding.php @@ -51,12 +51,19 @@ abstract class SAML2_Binding { public static function getCurrentBinding() { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': - return new SAML2_HTTPRedirect(); + if (array_key_exists('SAMLRequest', $_REQUEST) || array_key_exists('SAMLResponse', $_REQUEST)) { + return new SAML2_HTTPRedirect(); + } + break; + case 'POST': - return new SAML2_HTTPPost(); - default: - throw new Exception('Unable to find the current binding.'); + if (array_key_exists('SAMLRequest', $_REQUEST) || array_key_exists('SAMLResponse', $_REQUEST)) { + return new SAML2_HTTPPost(); + } + break; } + + throw new Exception('Unable to find the current binding.'); } -- GitLab