Skip to content

Commit b74fdfb

Browse files
committed
Add clockSkewTolerance setting
1 parent 2aaa5aa commit b74fdfb

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

advanced_settings_example.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@
8181
// (In order to validate the xml, 'strict' and 'wantXMLValidation' must be true).
8282
'wantXMLValidation' => true,
8383

84+
// The clock skew tolerance (in seconds) for the validation of the
85+
// IssueInstant attribute in the received responses.
86+
'clockSkewTolerance' => 180,
87+
8488
// If true, SAMLResponses with an empty value at its Destination
8589
// attribute will not be rejected for this fact.
8690
'relaxDestinationValidation' => false,

lib/Saml2/Settings.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,11 @@ private function _addDefaultValues()
398398
$this->_security['wantXMLValidation'] = true;
399399
}
400400

401+
// Clock skew tolerance
402+
if (!isset($this->_security['clockSkewTolerance'])) {
403+
$this->_security['clockSkewTolerance'] = 0;
404+
}
405+
401406
// SignatureAlgorithm
402407
if (!isset($this->_security['signatureAlgorithm'])) {
403408
$this->_security['signatureAlgorithm'] = XMLSecurityKey::RSA_SHA1;

tests/src/OneLogin/Saml2/SettingsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ public function testGetSecurityData()
918918
$this->assertArrayHasKey('wantNameIdEncrypted', $security);
919919
$this->assertArrayHasKey('requestedAuthnContext', $security);
920920
$this->assertArrayHasKey('wantXMLValidation', $security);
921+
$this->assertArrayHasKey('clockSkewTolerance', $security);
921922
$this->assertArrayHasKey('wantNameId', $security);
922923
}
923924

0 commit comments

Comments
 (0)