Skip to content
Snippets Groups Projects
Commit efca75e3 authored by Jelle Witteveen's avatar Jelle Witteveen
Browse files

Create a setting for the allowed assertion offset

parent 0b089801
No related branches found
No related tags found
No related merge requests found
......@@ -176,6 +176,15 @@ $config = [
*/
'enable.http_post' => false,
/*
* Set the allowed time difference between encrypting/decrypting assertions
*
* If you have an server that is constantly out of sync, this option
* allows you to adjust the allowed time-frame.
*
* Defaults to 60.
*/
'assertion.allowed_offset' => 60,
/************************
......
......@@ -656,20 +656,22 @@ class Message
$currentURL = \SimpleSAML\Utils\HTTP::getSelfURLNoQuery();
// check various properties of the assertion
$config = \SimpleSAML\Configuration::getInstance();
$allowed_assertion_offset = $config->getInteger('assertion.allowed_offset', 60);
$notBefore = $assertion->getNotBefore();
if ($notBefore !== null && $notBefore > time() + 60) {
if ($notBefore !== null && $notBefore > time() + $allowed_assertion_offset) {
throw new \SimpleSAML\Error\Exception(
'Received an assertion that is valid in the future. Check clock synchronization on IdP and SP.'
);
}
$notOnOrAfter = $assertion->getNotOnOrAfter();
if ($notOnOrAfter !== null && $notOnOrAfter <= time() - 60) {
if ($notOnOrAfter !== null && $notOnOrAfter <= time() - $allowed_assertion_offset) {
throw new \SimpleSAML\Error\Exception(
'Received an assertion that has expired. Check clock synchronization on IdP and SP.'
);
}
$sessionNotOnOrAfter = $assertion->getSessionNotOnOrAfter();
if ($sessionNotOnOrAfter !== null && $sessionNotOnOrAfter <= time() - 60) {
if ($sessionNotOnOrAfter !== null && $sessionNotOnOrAfter <= time() - $allowed_assertion_offset) {
throw new \SimpleSAML\Error\Exception(
'Received an assertion with a session that has expired. Check clock synchronization on IdP and SP.'
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment