Skip to content
Snippets Groups Projects
Commit bae1cd22 authored by Olav Morken's avatar Olav Morken
Browse files

consent: Use new statistics infrastructure.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3054 44740490-163a-0410-bde0-09ae8108e29a
parent 71fb8d36
No related branches found
No related tags found
No related merge requests found
...@@ -181,13 +181,17 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt ...@@ -181,13 +181,17 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
$state['Source'] = $idpmeta; $state['Source'] = $idpmeta;
} }
$statsData = array('spEntityID' => $spEntityId);
// Do not use consent if disabled // Do not use consent if disabled
if (isset($state['Source']['consent.disable']) && self::checkDisable($state['Source']['consent.disable'], $spEntityId)) { 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_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
SimpleSAML_Stats::log('consent:disabled', $statsData);
return; return;
} }
if (isset($state['Destination']['consent.disable']) && self::checkDisable($state['Destination']['consent.disable'], $idpEntityId)) { 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_Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
SimpleSAML_Stats::log('consent:disabled', $statsData);
return; return;
} }
...@@ -221,10 +225,12 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt ...@@ -221,10 +225,12 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) { if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) {
// Consent already given // Consent already given
SimpleSAML_Logger::stats('Consent: Consent found'); SimpleSAML_Logger::stats('Consent: Consent found');
SimpleSAML_Stats::log('consent:found', $statsData);
return; return;
} }
SimpleSAML_Logger::stats('Consent: Consent notfound'); SimpleSAML_Logger::stats('Consent: Consent notfound');
SimpleSAML_Stats::log('consent:notfound', $statsData);
$state['consent:store'] = $this->_store; $state['consent:store'] = $this->_store;
$state['consent:store.userId'] = $userId; $state['consent:store.userId'] = $userId;
...@@ -233,9 +239,11 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt ...@@ -233,9 +239,11 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
} catch (Exception $e) { } catch (Exception $e) {
SimpleSAML_Logger::error('Consent: Error reading from storage: ' . $e->getMessage()); SimpleSAML_Logger::error('Consent: Error reading from storage: ' . $e->getMessage());
SimpleSAML_Logger::stats('Consent: Failed'); SimpleSAML_Logger::stats('Consent: Failed');
SimpleSAML_Stats::log('consent:failed', $statsData);
} }
} else { } else {
SimpleSAML_Logger::stats('Consent: No storage'); SimpleSAML_Logger::stats('Consent: No storage');
SimpleSAML_Stats::log('consent:nostorage', $statsData);
} }
$state['consent:focus'] = $this->_focus; $state['consent:focus'] = $this->_focus;
...@@ -245,6 +253,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt ...@@ -245,6 +253,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
// User interaction nessesary. Throw exception on isPassive request // User interaction nessesary. Throw exception on isPassive request
if (isset($state['isPassive']) && $state['isPassive'] == true) { if (isset($state['isPassive']) && $state['isPassive'] == true) {
SimpleSAML_Stats::log('consent:nopassive', $statsData);
throw new SimpleSAML_Error_NoPassive( throw new SimpleSAML_Error_NoPassive(
'Unable to give consent on passive request.' 'Unable to give consent on passive request.'
); );
......
...@@ -42,6 +42,14 @@ if (array_key_exists('yes', $_REQUEST)) { ...@@ -42,6 +42,14 @@ if (array_key_exists('yes', $_REQUEST)) {
SimpleSAML_Logger::stats('consentResponse rememberNot'); 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) if ( array_key_exists('consent:store', $state)
&& array_key_exists('saveconsent', $_REQUEST) && array_key_exists('saveconsent', $_REQUEST)
&& $_REQUEST['saveconsent'] === '1' && $_REQUEST['saveconsent'] === '1'
......
...@@ -24,6 +24,12 @@ if (isset($state['Destination']['url.about'])) { ...@@ -24,6 +24,12 @@ if (isset($state['Destination']['url.about'])) {
$aboutService = $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(); $globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:noconsent.php'); $t = new SimpleSAML_XHTML_Template($globalConfig, 'consent:noconsent.php');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment