/** * @param string $requestId The SAML authentication request ID of the initial request (not subsequent proxy requests). * @return self */ public function forAuthentication($requestId) { if (!is_string($requestId)) { throw InvalidArgumentException::invalidType('string', 'requestId', $requestId); } $logger = new self($this->logger); $logger->sari = $requestId; return $logger; }
/** * @param string $attributeSetClassName */ public static function configureWhichAttributeSetToCreate($attributeSetClassName) { if (!is_string($attributeSetClassName) || empty($attributeSetClassName)) { throw InvalidArgumentException::invalidType('non-empty string', 'attributeSetClassName', $attributeSetClassName); } if (!is_a($attributeSetClassName, '\\Surfnet\\SamlBundle\\SAML2\\Attribute\\AttributeSetFactory', true)) { throw new InvalidArgumentException(sprintf('Cannot use class "%s": it must implement "%s"', $attributeSetClassName, '\\Surfnet\\SamlBundle\\SAML2\\Attribute\\AttributeSetFactory')); } self::$attributeSetClassName = $attributeSetClassName; }
/** * @param string $name * @param string $urnMace * @param string $urnOid */ public function __construct($name, $urnMace = null, $urnOid = null) { if (!is_string($name)) { throw InvalidArgumentException::invalidType('string', 'name', $name); } if (!is_null($urnMace) && !is_string($urnMace)) { throw InvalidArgumentException::invalidType('null or string', 'urnMace', $urnMace); } if (!is_null($urnOid) && !is_string($urnOid)) { throw InvalidArgumentException::invalidType('null or string', 'urnOid', $urnOid); } if (is_null($urnOid) && is_null($urnMace)) { throw new LogicException('An AttributeDefinition should have at least either a mace or an oid urn'); } $this->name = $name; $this->urnMace = $urnMace; $this->urnOid = $urnOid; }
/** * @param string $name * @param string $urnMace * @param string $urnOid * @param int $multiplicity */ public function __construct($name, $urnMace, $urnOid, $multiplicity = self::MULTIPLICITY_SINGLE) { if (!is_string($name)) { throw InvalidArgumentException::invalidType('string', 'name', $name); } if (!is_string($urnMace)) { throw InvalidArgumentException::invalidType('string', 'urnMace', $urnMace); } if (!is_string($urnOid)) { throw InvalidArgumentException::invalidType('string', 'urnOid', $urnOid); } if (!in_array($multiplicity, [self::MULTIPLICITY_SINGLE, self::MULTIPLICITY_MULTIPLE])) { throw new InvalidArgumentException(sprintf('Multiplicity should be once of "%s", "%s" given', implode('", "', [self::MULTIPLICITY_SINGLE, self::MULTIPLICITY_MULTIPLE]), $multiplicity)); } $this->name = $name; $this->multiplicity = $multiplicity; $this->urnMace = $urnMace; $this->urnOid = $urnOid; }
/** * @param string $nameId * @param string|null $format */ public function setSubject($nameId, $format = null) { if (!is_string($nameId)) { throw InvalidArgumentException::invalidType('string', 'nameId', $nameId); } if (!is_null($format) && !is_string($format)) { throw InvalidArgumentException::invalidType('string', 'format', $format); } $nameId = ['Value' => $nameId, 'Format' => $format ?: SAML2_Const::NAMEID_UNSPECIFIED]; $this->request->setNameId($nameId); }
/** * @param string $urn * @return AttributeDefinition */ public function getAttributeDefinitionByUrn($urn) { if (!is_string($urn) || empty($urn)) { throw InvalidArgumentException::invalidType('non-empty string', $urn, 'urn'); } if (array_key_exists($urn, $this->attributeDefinitionsByUrn)) { return $this->attributeDefinitionsByUrn[$urn]; } throw new UnknownUrnException($urn); }