private function processAssertions(Response $response)
{
$assertions = $response->getAssertions();
if (empty($assertions)) {
throw new NoAssertionsFoundException('No assertions found in response from IdP.');
}
if (!$this->responseIsSigned) {
foreach ($assertions as $assertion) {
if (!$assertion->getWasSignedAtConstruction()) {
throw new UnsignedResponseException('Both the response and the assertion it contains are not signed.');
}
}
}
return $this->assertionProcessor->processAssertions($assertions);
}