From 1dbd5149dbcc6500d2980351a7bb5b9c4b476274 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 10 Jul 2014 16:15:32 +0200 Subject: [PATCH] saml: Split statsData array out from statistics logging. This change makes it easier to add elements to the statistics data logged when the IdP sends an authentication response. --- modules/saml/lib/IdP/SAML1.php | 5 +++-- modules/saml/lib/IdP/SAML2.php | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/saml/lib/IdP/SAML1.php b/modules/saml/lib/IdP/SAML1.php index be68b66e7..ecac85d13 100644 --- a/modules/saml/lib/IdP/SAML1.php +++ b/modules/saml/lib/IdP/SAML1.php @@ -36,11 +36,12 @@ class sspmod_saml_IdP_SAML1 { $config = SimpleSAML_Configuration::getInstance(); $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); - SimpleSAML_Stats::log('saml:idp:Response', array( + $statsData = array( 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml1', - )); + ); + SimpleSAML_Stats::log('saml:idp:Response', $statsData); /* Generate and send response. */ $ar = new SimpleSAML_XML_Shib13_AuthnResponse(); diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index ffaf2ded2..527a64078 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -63,11 +63,12 @@ class sspmod_saml_IdP_SAML2 { /* Register the session association with the IdP. */ $idp->addAssociation($association); - SimpleSAML_Stats::log('saml:idp:Response', array( + $statsData = array( 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml2', - )); + ); + SimpleSAML_Stats::log('saml:idp:Response', $statsData); /* Send the response. */ $binding = SAML2_Binding::getBinding($protocolBinding); @@ -117,12 +118,13 @@ class sspmod_saml_IdP_SAML2 { ); $ar->setStatus($status); - SimpleSAML_Stats::log('saml:idp:Response:error', array( + $statsData = array( 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml2', 'error' => $status, - )); + ); + SimpleSAML_Stats::log('saml:idp:Response:error', $statsData); $binding = SAML2_Binding::getBinding($protocolBinding); $binding->send($ar); -- GitLab