|
| $map = array() |
| Associative array with the mappings of attribute names. More...
|
|
| $duplicate = false |
| Should attributes be duplicated or renamed. More...
|
|
Definition at line 10 of file AttributeMap.php.
◆ __construct()
sspmod_core_Auth_Process_AttributeMap::__construct |
( |
|
$config, |
|
|
|
$reserved |
|
) |
| |
Initialize this filter, parse configuration.
- Parameters
-
array | $config | Configuration information about this filter. |
mixed | $reserved | For future use. |
- Exceptions
-
Exception | If the configuration of the filter is wrong. |
Definition at line 32 of file AttributeMap.php.
References $config, and loadMapFile().
34 parent::__construct(
$config, $reserved);
39 foreach (
$config as $origName => $newName) {
40 if (is_int($origName)) {
41 if ($newName ===
'%duplicate') {
42 $this->duplicate =
true;
45 $mapFiles[] = $newName;
50 if (!is_string($origName)) {
51 throw new Exception(
'Invalid attribute name: '.var_export($origName,
true));
54 if (!is_string($newName) && !is_array($newName)) {
55 throw new Exception(
'Invalid attribute name: '.var_export($newName,
true));
58 $this->map[$origName] = $newName;
62 foreach ($mapFiles as &$file) {
loadMapFile($fileName)
Loads and merges in a file with a attribute map.
◆ loadMapFile()
sspmod_core_Auth_Process_AttributeMap::loadMapFile |
( |
|
$fileName | ) |
|
|
private |
Loads and merges in a file with a attribute map.
- Parameters
-
string | $fileName | Name of attribute map file. Expected to be in the attributemap directory in the root of the SimpleSAMLphp installation, or in the root of a module. |
- Exceptions
-
Exception | If the filter could not load the requested attribute map file. |
Definition at line 76 of file AttributeMap.php.
References $attributemap, $config, $m, SimpleSAML_Configuration\getInstance(), and SimpleSAML\Module\getModuleDir().
Referenced by __construct().
80 $m = explode(
':', $fileName);
81 if (count(
$m) === 2) {
83 throw new Exception(
"Module '$m[0]' is not enabled.");
87 $filePath =
$config->getPathValue(
'attributenamemapdir',
'attributemap/').$fileName.
'.php';
90 if (!file_exists($filePath)) {
91 throw new Exception(
'Could not find attribute map file: '.$filePath);
97 throw new Exception(
'Attribute map file "'.$filePath.
'" didn\'t define an attribute map.');
100 if ($this->duplicate) {
101 $this->map = array_merge_recursive($this->map,
$attributemap);
static getModuleDir($module)
Retrieve the base directory for a module.
Attribute-related utility methods.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
◆ process()
sspmod_core_Auth_Process_AttributeMap::process |
( |
& |
$request | ) |
|
Apply filter to rename attributes.
- Parameters
-
array | &$request | The current request. |
Definition at line 113 of file AttributeMap.php.
References $name, $request, and $values.
116 assert(array_key_exists(
'Attributes',
$request));
118 $mapped_attributes = array();
121 if (array_key_exists(
$name, $this->map)) {
122 if (!is_array($this->map[
$name])) {
123 if ($this->duplicate) {
128 foreach ($this->map[$name] as $to_map) {
129 $mapped_attributes[$to_map] =
$values;
131 if ($this->duplicate && !in_array($name, $this->map[$name],
true)) {
140 $request[
'Attributes'] = $mapped_attributes;
foreach($paths as $path) $request
◆ $duplicate
sspmod_core_Auth_Process_AttributeMap::$duplicate = false |
|
private |
Should attributes be duplicated or renamed.
Definition at line 21 of file AttributeMap.php.
◆ $map
sspmod_core_Auth_Process_AttributeMap::$map = array() |
|
private |
Associative array with the mappings of attribute names.
Definition at line 16 of file AttributeMap.php.
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/core/lib/Auth/Process/AttributeMap.php