/** * @test */ public function shouldReturnServiceInfoByIdpIDWhenGetIsCalled() { $col = new ServiceInfoCollection(); $expectedServiceInfo_1 = $this->createServiceInfoStub($expectedProviderID_1 = 'main', $expectedIdpID_1 = 'idp1', null, null, null, null); $expectedServiceInfo_2 = $this->createServiceInfoStub($expectedProviderID_2 = 'main', $expectedIdpID_2 = 'idp2', null, null, null, null); $col->add($expectedServiceInfo_1); $col->add($expectedServiceInfo_2); $this->assertEquals($expectedServiceInfo_1, $col->get($expectedIdpID_1)); $this->assertEquals($expectedServiceInfo_2, $col->get($expectedIdpID_2)); }
/** * @param SamlSpInfo $samlInfo * @param Request $request * @return ServiceInfo * @throws \RuntimeException */ protected function getServiceInfo(SamlSpInfo $samlInfo, Request $request) { $serviceInfo = $this->serviceInfoCollection->get($samlInfo->getAuthenticationServiceID()); if (!$serviceInfo) { throw new \RuntimeException("redirect to discovery"); } if (!$serviceInfo->getSpSigningProvider()->isEnabled()) { throw new \RuntimeException('Signing is required for Logout'); } $serviceInfo->getSpProvider()->setRequest($request); return $serviceInfo; }