1 <?php declare(strict_types=1);
35 preg_match(self::ATTR_REGEX, $this->rule->getExternalAttribute(), $matches);
37 if (is_array($matches) && isset($matches[3]) && is_numeric($matches[3])) {
38 $index = (int) $matches[3];
52 preg_match(self::ATTR_REGEX, $this->rule->getExternalAttribute(), $matches);
54 if (is_array($matches) && isset($matches[1]) && is_string($matches[1])) {
55 $attribute = $matches[1];
65 public function parse() : string
69 if (!array_key_exists($attributeKey, $this->userData)) {
70 throw new \ilSamlException(sprintf(
71 "Configured external attribute of mapping '%s' -> '%s' does not exist in SAML attribute data.",
72 $this->rule->getAttribute(),
73 $this->rule->getExternalAttribute()
77 $value = $this->userData[$attributeKey];
79 if (is_array($value)) {
82 if (!array_key_exists($valueIndex, $value)) {
83 throw new \ilSamlException(sprintf(
84 "Configured external attribute of mapping '%s' -> '%s' does not exist in SAML attribute data.",
85 $this->rule->getAttribute(),
86 $this->rule->getExternalAttribute()
90 $value = $value[$valueIndex];
93 if (!is_scalar($value)) {
94 throw new \ilSamlException(sprintf(
95 "Could not parse a scalar value based on the user attribute mapping '%s' -> '%s'.",
96 $this->rule->getAttribute(),
97 $this->rule->getExternalAttribute()
101 return (
string) $value;
__construct(\ilExternalAuthUserAttributeMappingRule $rule, array $userData)
ilSamlMappedUserAttributeValueParser constructor.
Class ilExternalAuthUserAttributeMappingRule.
Class ilSamlMappedUserAttributeValueParser.