/** * @param ProfileContext $context * * @return string|null */ protected function getDescriptorType(ProfileContext $context) { return $context->getOwnRole() == ProfileContext::ROLE_IDP ? SpSsoDescriptor::class : IdpSsoDescriptor::class; }
/** * @param ProfileContext $context * @param string $location * * @return CriteriaSet */ protected function getCriteriaSet(ProfileContext $context, $location) { $criteriaSet = new CriteriaSet([new DescriptorTypeCriteria($context->getOwnRole() === ProfileContext::ROLE_IDP ? IdpSsoDescriptor::class : SpSsoDescriptor::class), new LocationCriteria($location)]); return $criteriaSet; }
public function test__profile_id_and_own_role_set_in_constructor() { $profileContext = new ProfileContext(Profiles::METADATA, ProfileContext::ROLE_IDP); $this->assertEquals(Profiles::METADATA, $profileContext->getProfileId()); $this->assertEquals(ProfileContext::ROLE_IDP, $profileContext->getOwnRole()); }