From f389bb73ef15d219c1af6b0f94e433878e8dafd9 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Mon, 3 Aug 2009 12:44:26 +0000 Subject: [PATCH] SAML2: Move constants from sspmod_saml2_Const to SAML2_Const. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1597 44740490-163a-0410-bde0-09ae8108e29a --- {modules/saml2/lib => lib/SAML2}/Const.php | 6 +----- lib/SimpleSAML/XML/SAML20/AuthnResponse.php | 6 +++--- modules/saml2/lib/Error.php | 10 +++++----- 3 files changed, 9 insertions(+), 13 deletions(-) rename {modules/saml2/lib => lib/SAML2}/Const.php (96%) diff --git a/modules/saml2/lib/Const.php b/lib/SAML2/Const.php similarity index 96% rename from modules/saml2/lib/Const.php rename to lib/SAML2/Const.php index 2929ec38a..896872daa 100644 --- a/modules/saml2/lib/Const.php +++ b/lib/SAML2/Const.php @@ -6,33 +6,29 @@ * @package simpleSAMLphp * @version $Id$ */ -class sspmod_saml2_Const { +class SAML2_Const { /** * Top-level status code indicating successful processing of the request. */ const STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success'; - /** * Top-level status code indicating that there was a problem with the request. */ const STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester'; - /** * Top-level status code indicating that there was a problem generating the response. */ const STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder'; - /** * Top-level status code indicating that the request was from an unsupported version of the SAML protocol. */ const STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch'; - /** * Second-level status code for NoPassive errors. */ diff --git a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php index 32ee3aa77..0c38b82a5 100644 --- a/lib/SimpleSAML/XML/SAML20/AuthnResponse.php +++ b/lib/SimpleSAML/XML/SAML20/AuthnResponse.php @@ -676,10 +676,10 @@ class SimpleSAML_XML_SAML20_AuthnResponse extends SimpleSAML_XML_AuthnResponse { if (is_string($status)) { if ($status === 'Success') { /* Not really an error, but it makes the code simpler. */ - $status = new sspmod_saml2_Error(sspmod_saml2_Const::STATUS_SUCCESS); + $status = new sspmod_saml2_Error(SAML2_Const::STATUS_SUCCESS); } else { $status = new sspmod_saml2_Error( - sspmod_saml2_Const::STATUS_RESPONDER, + SAML2_Const::STATUS_RESPONDER, 'urn:oasis:names:tc:SAML:2.0:status:' . $status ); } @@ -763,7 +763,7 @@ class SimpleSAML_XML_SAML20_AuthnResponse extends SimpleSAML_XML_AuthnResponse { if (!empty($inresponseto)) $inresponsetoText = 'InResponseTo="' . htmlspecialchars($inresponseto). '" '; $assertion = ""; - if ($status->getStatus() === sspmod_saml2_Const::STATUS_SUCCESS) { + if ($status->getStatus() === SAML2_Const::STATUS_SUCCESS) { $assertion = '<saml:Assertion Version="2.0" ID="' . $assertionid . '" IssueInstant="' . $issueInstant . '"> <saml:Issuer>' . htmlspecialchars($issuer) . '</saml:Issuer> diff --git a/modules/saml2/lib/Error.php b/modules/saml2/lib/Error.php index 39153ceea..cdb017916 100644 --- a/modules/saml2/lib/Error.php +++ b/modules/saml2/lib/Error.php @@ -107,15 +107,15 @@ class sspmod_saml2_Error extends SimpleSAML_Error_Exception { } elseif ($exception instanceof SimpleSAML_Error_NoPassive) { $e = new self( - sspmod_saml2_Const::STATUS_RESPONDER, - sspmod_saml2_Const::STATUS_NO_PASSIVE, + SAML2_Const::STATUS_RESPONDER, + SAML2_Const::STATUS_NO_PASSIVE, $exception->getMessage(), $exception ); } else { $e = new self( - sspmod_saml2_Const::STATUS_RESPONDER, + SAML2_Const::STATUS_RESPONDER, NULL, get_class($exception) . ': ' . $exception->getMessage(), $exception @@ -148,9 +148,9 @@ class sspmod_saml2_Error extends SimpleSAML_Error_Exception { $e = NULL; switch ($this->status) { - case sspmod_saml2_Const::STATUS_RESPONDER: + case SAML2_Const::STATUS_RESPONDER: switch ($this->subStatus) { - case sspmod_saml2_Const::STATUS_NO_PASSIVE: + case SAML2_Const::STATUS_NO_PASSIVE: $e = new SimpleSAML_Error_NoPassive($this->statusMessage, 0, $this); break; } -- GitLab