/**
  * @expectedException EngineBlock_Corto_Module_Bindings_UnsupportedBindingException
  */
 public function testResponseRedirectIsNotSupported()
 {
     $response = new EngineBlock_Saml2_ResponseAnnotationDecorator(new SAML2_Response());
     $response->setDeliverByBinding(SAML2_Const::BINDING_HTTP_REDIRECT);
     $remoteEntity = new ServiceProvider('https://sp.example.edu');
     $this->bindings->send($response, $remoteEntity);
 }
 protected function _createBaseResponse(EngineBlock_Saml2_AuthnRequestAnnotationDecorator $request)
 {
     if ($request->getVoContext() && $request->isVoContextExplicit()) {
         $this->setVirtualOrganisationContext($request->getVoContext());
     }
     if ($keyId = $request->getKeyId()) {
         $this->setKeyId($keyId);
     }
     $requestWasUnsolicited = $request->isUnsolicited();
     $response = new SAML2_Response();
     /** @var SAML2_AuthnRequest $request */
     $response->setRelayState($request->getRelayState());
     $response->setId($this->getNewId(IdFrame::ID_USAGE_SAML2_RESPONSE));
     $response->setIssueInstant(time());
     if (!$requestWasUnsolicited) {
         $response->setInResponseTo($request->getId());
     }
     $response->setDestination($request->getIssuer());
     $response->setIssuer($this->getUrl('idpMetadataService', $request->getIssuer(), $request));
     $acs = $this->getRequestAssertionConsumer($request);
     $response->setDestination($acs->location);
     $response->setStatus(array('Code' => SAML2_Const::STATUS_SUCCESS));
     $response = new EngineBlock_Saml2_ResponseAnnotationDecorator($response);
     $response->setDeliverByBinding($acs->binding);
     return $response;
 }