/** * @param Assertion $assertion * @param int $now * @param int $allowedSecondsSkew */ protected function validateSubject(Assertion $assertion, $now, $allowedSecondsSkew) { if (false == $assertion->getSubject()) { return; } foreach ($assertion->getSubject()->getAllSubjectConfirmations() as $subjectConfirmation) { if ($subjectConfirmation->getSubjectConfirmationData()) { if (false == Helper::validateNotBefore($subjectConfirmation->getSubjectConfirmationData()->getNotBeforeTimestamp(), $now, $allowedSecondsSkew)) { throw new LightSamlValidationException('SubjectConfirmationData.NotBefore must not be in the future'); } if (false == Helper::validateNotOnOrAfter($subjectConfirmation->getSubjectConfirmationData()->getNotOnOrAfterTimestamp(), $now, $allowedSecondsSkew)) { throw new LightSamlValidationException('SubjectConfirmationData.NotOnOrAfter must not be in the past'); } } } }
/** * @dataProvider notOnOrAfterProvider */ public function test__validate_not_on_or_after($notOnOrAfter, $now, $allowedSecondsSkew, $expected) { $this->assertEquals($expected, Helper::validateNotOnOrAfter($notOnOrAfter, $now, $allowedSecondsSkew)); }