示例#1
0
 public function test_receive_response_profile()
 {
     $buildContainer = $this->getBuildContainer('_1db06e4f91d3997b7ed3285a59f77028071db2dc5f', new TimeProviderMock(new \DateTime('@' . Helper::parseSAMLTime('2015-11-22T15:37:14Z'), new \DateTimeZone('UTC'))));
     $builder = new \LightSaml\Builder\Profile\WebBrowserSso\Sp\SsoSpReceiveResponseProfileBuilder($buildContainer);
     $context = $builder->buildContext();
     $action = $builder->buildAction();
     $request = Request::create('https://localhost/lightsaml/lightSAML/web/sp/acs.php', 'POST', ['SAMLResponse' => $this->getSamlResponseCode()]);
     $context->getHttpRequestContext()->setRequest($request);
     $action->execute($context);
     /** @var Response $response */
     $response = $context->getInboundMessage();
     $this->assertInstanceOf(Response::class, $response);
     $this->assertCount(1, $response->getAllAssertions());
     $this->assertEquals('*****@*****.**', $response->getFirstAssertion()->getFirstAttributeStatement()->getFirstAttributeByName(ClaimTypes::EMAIL_ADDRESS)->getFirstAttributeValue());
 }