/** * @param ProfileContext $context */ protected function doExecute(ProfileContext $context) { $partyContext = $context->getPartyEntityContext(); if ($partyContext->getEntityDescriptor() && $partyContext->getTrustOptions()) { $this->logger->debug(sprintf('Party EntityDescriptor and TrustOptions already set for "%s"', $partyContext->getEntityDescriptor()->getEntityID()), LogHelper::getActionContext($context, $this, array('partyEntityId' => $partyContext->getEntityDescriptor()->getEntityID()))); return; } $entityId = $partyContext->getEntityDescriptor() ? $partyContext->getEntityDescriptor()->getEntityID() : null; $entityId = $entityId ? $entityId : $partyContext->getEntityId(); if (null == $entityId) { $message = 'EntityID is not set in the party context'; $this->logger->critical($message, LogHelper::getActionErrorContext($context, $this)); throw new LightSamlContextException($context, $message); } if (null == $partyContext->getEntityDescriptor()) { $partyEntityDescriptor = $this->getPartyEntityDescriptor($context, $context->getOwnRole() === ProfileContext::ROLE_IDP ? $this->spEntityDescriptorProvider : $this->idpEntityDescriptorProvider, $context->getPartyEntityContext()->getEntityId()); $partyContext->setEntityDescriptor($partyEntityDescriptor); $this->logger->debug(sprintf('Known issuer resolved: "%s"', $partyEntityDescriptor->getEntityID()), LogHelper::getActionContext($context, $this, array('partyEntityId' => $partyEntityDescriptor->getEntityID()))); } if (null == $partyContext->getTrustOptions()) { $trustOptions = $this->trustOptionsProvider->get($partyContext->getEntityDescriptor()->getEntityID()); if (null === $trustOptions) { $trustOptions = new TrustOptions(); } $partyContext->setTrustOptions($trustOptions); } }
/** * @param string $entityId * * @return TrustOptions|null */ public function get($entityId) { if ($this->first && $this->first->has($entityId)) { return $this->first->get($entityId); } if ($this->second && $this->second->has($entityId)) { return $this->second->get($entityId); } return null; }
/** * @param ProfileContext $context */ protected function doExecute(ProfileContext $context) { $partyContext = $context->getPartyEntityContext(); $partyEntityDescriptor = $this->getPartyEntityDescriptor($context); $partyContext->setEntityId($partyEntityDescriptor->getEntityID())->setEntityDescriptor($partyEntityDescriptor); $trustOptions = $this->trustOptionsProvider->get($partyContext->getEntityDescriptor()->getEntityID()); if (null === $trustOptions) { $trustOptions = new TrustOptions(); } $partyContext->setTrustOptions($trustOptions); }