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; }