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

saml: Add total time of login operation to stats data.

Add statistics data to saml:idp:Response and saml:idp:Response:error
with the total time since we began processing the authentication
request.
parent 1dbd5149
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,9 @@ class sspmod_saml_IdP_SAML1 { ...@@ -41,6 +41,9 @@ class sspmod_saml_IdP_SAML1 {
'idpEntityID' => $idpMetadata->getString('entityid'), 'idpEntityID' => $idpMetadata->getString('entityid'),
'protocol' => 'saml1', 'protocol' => 'saml1',
); );
if (isset($state['saml:AuthnRequestReceivedAt'])) {
$statsData['logintime'] = microtime(TRUE) - $state['saml:AuthnRequestReceivedAt'];
}
SimpleSAML_Stats::log('saml:idp:Response', $statsData); SimpleSAML_Stats::log('saml:idp:Response', $statsData);
/* Generate and send response. */ /* Generate and send response. */
...@@ -122,6 +125,7 @@ class sspmod_saml_IdP_SAML1 { ...@@ -122,6 +125,7 @@ class sspmod_saml_IdP_SAML1 {
'saml:shire' => $shire, 'saml:shire' => $shire,
'saml:target' => $target, 'saml:target' => $target,
'saml:AuthnRequestReceivedAt' => microtime(TRUE),
); );
$idp->handleAuthenticationRequest($state); $idp->handleAuthenticationRequest($state);
......
...@@ -68,6 +68,9 @@ class sspmod_saml_IdP_SAML2 { ...@@ -68,6 +68,9 @@ class sspmod_saml_IdP_SAML2 {
'idpEntityID' => $idpMetadata->getString('entityid'), 'idpEntityID' => $idpMetadata->getString('entityid'),
'protocol' => 'saml2', 'protocol' => 'saml2',
); );
if (isset($state['saml:AuthnRequestReceivedAt'])) {
$statsData['logintime'] = microtime(TRUE) - $state['saml:AuthnRequestReceivedAt'];
}
SimpleSAML_Stats::log('saml:idp:Response', $statsData); SimpleSAML_Stats::log('saml:idp:Response', $statsData);
/* Send the response. */ /* Send the response. */
...@@ -124,6 +127,9 @@ class sspmod_saml_IdP_SAML2 { ...@@ -124,6 +127,9 @@ class sspmod_saml_IdP_SAML2 {
'protocol' => 'saml2', 'protocol' => 'saml2',
'error' => $status, 'error' => $status,
); );
if (isset($state['saml:AuthnRequestReceivedAt'])) {
$statsData['logintime'] = microtime(TRUE) - $state['saml:AuthnRequestReceivedAt'];
}
SimpleSAML_Stats::log('saml:idp:Response:error', $statsData); SimpleSAML_Stats::log('saml:idp:Response:error', $statsData);
$binding = SAML2_Binding::getBinding($protocolBinding); $binding = SAML2_Binding::getBinding($protocolBinding);
...@@ -377,6 +383,7 @@ class sspmod_saml_IdP_SAML2 { ...@@ -377,6 +383,7 @@ class sspmod_saml_IdP_SAML2 {
'saml:NameIDFormat' => $nameIDFormat, 'saml:NameIDFormat' => $nameIDFormat,
'saml:AllowCreate' => $allowCreate, 'saml:AllowCreate' => $allowCreate,
'saml:Extensions' => $extensions, 'saml:Extensions' => $extensions,
'saml:AuthnRequestReceivedAt' => microtime(TRUE),
); );
$idp->handleAuthenticationRequest($state); $idp->handleAuthenticationRequest($state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment