From bc620d4a798165c6a8d33572a9e07b4a2b810fd9 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 19 Aug 2009 06:15:14 +0000 Subject: [PATCH] SimpleSAML_XML_Shib13_AuthnResponse: Remove configuration and metadata parameters. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1688 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Bindings/Shib13/HTTPPost.php | 2 +- lib/SimpleSAML/XML/Shib13/AuthnResponse.php | 13 +++++++------ www/shib13/idp/SSOService.php | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index c4554749c..f776889da 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -120,7 +120,7 @@ class SimpleSAML_Bindings_Shib13_HTTPPost { SimpleSAML_Utilities::validateXMLDocument($samlResponseXML, 'saml11'); - $samlResponse = new SimpleSAML_XML_Shib13_AuthnResponse($this->configuration, $this->metadata); + $samlResponse = new SimpleSAML_XML_Shib13_AuthnResponse(); $samlResponse->setXML($samlResponseXML); if (array_key_exists('TARGET', $post)) { diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index e1b7c564f..f3b6bb167 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -18,9 +18,7 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse { const SHIB_PROTOCOL_NS = 'urn:oasis:names:tc:SAML:1.0:protocol'; const SHIB_ASSERT_NS = 'urn:oasis:names:tc:SAML:1.0:assertion'; - function __construct(SimpleSAML_Configuration $configuration, SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore) { - $this->configuration = $configuration; - $this->metadata = $metadatastore; + function __construct() { } // Inhereted public function setXML($xml) { @@ -40,7 +38,8 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse { $issuer = $this->getIssuer(); /* Get the metadata of the issuer. */ - $md = $this->metadata->getMetaData($issuer, 'shib13-idp-remote'); + $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); + $md = $metadata->getMetaData($issuer, 'shib13-idp-remote'); if(array_key_exists('certFingerprint', $md)) { /* Get fingerprint for the certificate of the issuer. */ @@ -50,7 +49,8 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse { $this->validator->validateFingerprint($issuerFingerprint); } elseif(array_key_exists('caFile', $md)) { /* Validate against CA. */ - $this->validator->validateCA($this->configuration->getPathValue('certdir', 'cert/') . $md['caFile']); + $globalConfig = SimpleSAML_Configuration::getInstance(); + $this->validator->validateCA($globalConfig->getPathValue('certdir', 'cert/') . $md['caFile']); } else { throw new Exception('Required field [certFingerprint] or [caFile] in Shibboleth 1.3 IdP Remote metadata was not found for identity provider [' . $issuer . ']. Please add a fingerprint and try again. You can add a dummy fingerprint first, and then an error message will be printed with the real fingerprint.'); } @@ -130,7 +130,8 @@ class SimpleSAML_XML_Shib13_AuthnResponse extends SimpleSAML_XML_AuthnResponse { public function getAttributes() { - $md = $this->metadata->getMetadata($this->getIssuer(), 'shib13-idp-remote'); + $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); + $md = $metadata->getMetadata($this->getIssuer(), 'shib13-idp-remote'); $base64 = isset($md['base64attributes']) ? $md['base64attributes'] : false; if (! ($this->getDOM() instanceof DOMDocument) ) { diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php index ce2b6bba4..ce3267772 100644 --- a/www/shib13/idp/SSOService.php +++ b/www/shib13/idp/SSOService.php @@ -202,7 +202,7 @@ try { $attributes = $authProcState['Attributes']; /* Generate and send response. */ - $ar = new SimpleSAML_XML_Shib13_AuthnResponse($config, $metadata); + $ar = new SimpleSAML_XML_Shib13_AuthnResponse(); $authnResponseXML = $ar->generate($idpmetadata, $spmetadata, $shire, $attributes); $httppost = new SimpleSAML_Bindings_Shib13_HTTPPost($config, $metadata); -- GitLab