Definition at line 9 of file GenerateGroups.php.
◆ __construct()
sspmod_core_Auth_Process_GenerateGroups::__construct |
( |
|
$config, |
|
|
|
$reserved |
|
) |
| |
Initialize this filter.
- Parameters
-
array | $config | Configuration information about this filter. |
mixed | $reserved | For future use. |
Definition at line 24 of file GenerateGroups.php.
References $config.
25 parent::__construct(
$config, $reserved);
31 $this->generateGroupsFrom = array(
32 'eduPersonAffiliation',
34 'eduPersonEntitlement',
39 foreach (
$config as $attributeName) {
40 if (!is_string($attributeName)) {
41 throw new Exception(
'Invalid attribute name for core:GenerateGroups filter: ' .
42 var_export($attributeName, TRUE));
46 $this->generateGroupsFrom =
$config;
◆ escapeIllegalChars()
static sspmod_core_Auth_Process_GenerateGroups::escapeIllegalChars |
( |
|
$string | ) |
|
|
staticprivate |
Escape special characters in a string.
This function is similar to urlencode, but encodes many more characters. This function takes any characters not in [a-zA-Z0-9_@=.] and encodes them with as %<hex version>="">. For example, it will encode '+' as '%2b' and '' as '%25'.
- Parameters
-
string | $string | The string which should be escaped. |
- Returns
- string The escaped string.
Definition at line 134 of file GenerateGroups.php.
135 assert(is_string($string));
137 return preg_replace_callback(
'/([^a-zA-Z0-9_@=.])/',
138 function (
$m) {
return sprintf(
"%%%02x", ord(
$m[1])); },
◆ getRealm()
static sspmod_core_Auth_Process_GenerateGroups::getRealm |
( |
|
$attributes | ) |
|
|
staticprivate |
Determine which realm the user belongs to.
This function will attempt to determine the realm a user belongs to based on the eduPersonPrincipalName attribute if it is present. If it isn't, or if it doesn't contain a realm, NULL will be returned.
- Parameters
-
array | $attributes | The attributes of the user. |
- Returns
- string|NULL The realm of the user, or NULL if we are unable to determine the realm.
Definition at line 101 of file GenerateGroups.php.
104 if (!array_key_exists(
'eduPersonPrincipalName',
$attributes)) {
109 if (count($eppn) < 1) {
114 $realm = explode(
'@', $eppn, 2);
115 if (count($realm) < 2) {
120 return self::escapeIllegalChars($realm);
if(array_key_exists('yes', $_REQUEST)) $attributes
◆ process()
sspmod_core_Auth_Process_GenerateGroups::process |
( |
& |
$request | ) |
|
Apply filter to add groups attribute.
- Parameters
-
array | &$request | The current request |
Definition at line 56 of file GenerateGroups.php.
References $attributes, $name, $request, and SimpleSAML\Logger\debug().
58 assert(array_key_exists(
'Attributes',
$request));
64 if ($realm !== NULL) {
65 $groups[] =
'realm-' . $realm;
69 foreach ($this->generateGroupsFrom as
$name) {
72 /* Attribute not present. */ 76 foreach ($attributes[$name] as $value) { 77 $value = self::escapeIllegalChars($value); 78 $groups[] = $name . '-
' . $value; 79 if ($realm !== NULL) { 80 $groups[] = $name . '-
' . $realm . '-
' . $value; 85 if (count($groups) > 0) { 86 $attributes['groups
'] = $groups; foreach($paths as $path) $request
if(array_key_exists('yes', $_REQUEST)) $attributes
◆ $generateGroupsFrom
sspmod_core_Auth_Process_GenerateGroups::$generateGroupsFrom |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/core/lib/Auth/Process/GenerateGroups.php