diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php index 6e87ca038c143a87cd7047bb566253c1566e3f0c..cf57ba3c236bb1d5e9c129dfd033a0f17ed6b9f8 100644 --- a/modules/consent/lib/Auth/Process/Consent.php +++ b/modules/consent/lib/Auth/Process/Consent.php @@ -181,13 +181,17 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt $state['Source'] = $idpmeta; } + $statsData = array('spEntityID' => $spEntityId); + // Do not use consent if disabled if (isset($state['Source']['consent.disable']) && self::checkDisable($state['Source']['consent.disable'], $spEntityId)) { SimpleSAML_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId); + SimpleSAML_Stats::log('consent:disabled', $statsData); return; } if (isset($state['Destination']['consent.disable']) && self::checkDisable($state['Destination']['consent.disable'], $idpEntityId)) { SimpleSAML_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId); + SimpleSAML_Stats::log('consent:disabled', $statsData); return; } @@ -221,10 +225,12 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) { // Consent already given SimpleSAML_Logger::stats('Consent: Consent found'); + SimpleSAML_Stats::log('consent:found', $statsData); return; } SimpleSAML_Logger::stats('Consent: Consent notfound'); + SimpleSAML_Stats::log('consent:notfound', $statsData); $state['consent:store'] = $this->_store; $state['consent:store.userId'] = $userId; @@ -233,9 +239,11 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt } catch (Exception $e) { SimpleSAML_Logger::error('Consent: Error reading from storage: ' . $e->getMessage()); SimpleSAML_Logger::stats('Consent: Failed'); + SimpleSAML_Stats::log('consent:failed', $statsData); } } else { SimpleSAML_Logger::stats('Consent: No storage'); + SimpleSAML_Stats::log('consent:nostorage', $statsData); } $state['consent:focus'] = $this->_focus; @@ -245,6 +253,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt // User interaction nessesary. Throw exception on isPassive request if (isset($state['isPassive']) && $state['isPassive'] == true) { + SimpleSAML_Stats::log('consent:nopassive', $statsData); throw new SimpleSAML_Error_NoPassive( 'Unable to give consent on passive request.' ); diff --git a/modules/consent/www/getconsent.php b/modules/consent/www/getconsent.php index 84acd064f8a3d29f4caf5f0a3f0bf84502878606..a148eebfc9bf368cc1a7515b08ccf5a80124b0ae 100644 --- a/modules/consent/www/getconsent.php +++ b/modules/consent/www/getconsent.php @@ -42,6 +42,14 @@ if (array_key_exists('yes', $_REQUEST)) { SimpleSAML_Logger::stats('consentResponse rememberNot'); } + $statsInfo = array( + 'remember' => array_key_exists('saveconsent', $_REQUEST), + ); + if (isset($state['Destination']['entityid'])) { + $statsInfo['spEntityID'] = $state['Destination']['entityid']; + } + SimpleSAML_Stats::log('consent:accept', $statsInfo); + if ( array_key_exists('consent:store', $state) && array_key_exists('saveconsent', $_REQUEST) && $_REQUEST['saveconsent'] === '1' diff --git a/modules/consent/www/noconsent.php b/modules/consent/www/noconsent.php index b1982338817cfcd06b8b0da4cdc0f477555cbc61..85d2e67665124a093911f6d96d452827e032f3be 100644 --- a/modules/consent/www/noconsent.php +++ b/modules/consent/www/noconsent.php @@ -24,6 +24,12 @@ if (isset($state['Destination']['url.about'])) { $aboutService = $state['Destination']['url.about']; } +$statsInfo = array(); +if (isset($state['Destination']['entityid'])) { + $statsInfo['spEntityID'] = $state['Destination']['entityid']; +} +SimpleSAML_Stats::log('consent:reject', $statsInfo); + $globalConfig = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:noconsent.php');