/**
  * Resolve the eduPersonTargetedId we should send.
  */
 public function execute()
 {
     // Note that we try to service the final destination SP, if we know them and are allowed to do so.
     $destinationMetadata = EngineBlock_SamlHelper::getDestinationSpMetadata($this->_serviceProvider, $this->_request, $this->_server->getRepository());
     // Resolve what NameID we should send the destination.
     $resolver = new EngineBlock_Saml2_NameIdResolver();
     $nameId = $resolver->resolve($this->_request, $this->_response, $destinationMetadata, $this->_collabPersonId);
     // EPTID requires us to embed the <saml:NameID> element instead of just the value, so we generate that here.
     $document = new DOMDocument();
     $document->loadXML('<base />');
     SAML2_Utils::addNameId($document->documentElement, $nameId);
     // Add the eduPersonTargetedId attribute.
     $this->_responseAttributes['urn:mace:dir:attribute-def:eduPersonTargetedID'] = array($document->documentElement->childNodes);
 }
 public function testNameIDIsAddedAtCorrectLocation()
 {
     global $_SESSION;
     $_SESSION = array();
     // Input
     $nameId = array('Format' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', 'Value' => '');
     $this->serviceProvider->nameIdFormat = $nameId['Format'];
     // Run
     $resolvedNameId = $this->resolver->resolve($this->request, $this->response, $this->serviceProvider, $this->collabPersonId);
     // Test
     $this->assertNotEmpty($resolvedNameId);
 }
 /**
  * Resolve what NameID we should send to our SP and set it in the Assertion.
  */
 public function execute()
 {
     $resolver = new EngineBlock_Saml2_NameIdResolver();
     $nameId = $resolver->resolve($this->_request, $this->_response, $this->_serviceProvider, $this->_collabPersonId);
     $this->_response->getAssertion()->setNameId($nameId);
 }