From 71cd422a591830931af6cec5d587c874a115df63 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 14 May 2008 07:27:21 +0000 Subject: [PATCH] Make it possible to set a default value for IsPassive in SP-hosted metadata. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@554 44740490-163a-0410-bde0-09ae8108e29a --- docs/source/simplesamlphp-sp.xml | 9 +++++++++ lib/SimpleSAML/XML/SAML20/AuthnRequest.php | 21 ++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/source/simplesamlphp-sp.xml b/docs/source/simplesamlphp-sp.xml index ee67158c6..7e2f8c038 100644 --- a/docs/source/simplesamlphp-sp.xml +++ b/docs/source/simplesamlphp-sp.xml @@ -247,6 +247,15 @@ set, the SP receives all attributes available at the IdP.</para> </glossdef> </glossentry> + + <glossentry> + <glossterm>IsPassive</glossterm> + + <glossdef> + <para>IsPassive allows you to enable passive authentication by + default for this SP.</para> + </glossdef> + </glossentry> </glosslist> </section> diff --git a/lib/SimpleSAML/XML/SAML20/AuthnRequest.php b/lib/SimpleSAML/XML/SAML20/AuthnRequest.php index bf591eeb4..b3e5fb113 100644 --- a/lib/SimpleSAML/XML/SAML20/AuthnRequest.php +++ b/lib/SimpleSAML/XML/SAML20/AuthnRequest.php @@ -20,7 +20,7 @@ class SimpleSAML_XML_SAML20_AuthnRequest { private $message = null; private $dom; private $relayState = null; - private $isPassive = 'false'; + private $isPassive = null; const PROTOCOL = 'saml2'; @@ -234,6 +234,25 @@ class SimpleSAML_XML_SAML20_AuthnRequest { </samlp:RequestedAuthnContext>'; } + + /* Check the metadata for isPassive if $this->isPassive === NULL. */ + if($this->isPassive === NULL) { + /* + * Process the SAML 2.0 SP hosted metadata parameter: IsPassive + */ + if (isset($md['IsPassive'])) { + if (is_bool($md['IsPassive'])) { + $this->isPassive = ($md['IsPassive'] ? 'true' : 'false'); + } else { + throw new Exception('Illegal format of the IsPassive parameter in' . + ' the SAML 2.0 SP hosted metadata for entity [' . $spentityid . + ']. This value should be set to a PHP boolean value.'); + } + } else { + /* The default is off. */ + $this->isPassive = 'false'; + } + } /* -- GitLab