|
| getGroups (array $attributes) |
| This section of code was broken out because the child filter AuthorizeByGroup can use this method as well. More...
|
|
| search ($memberof) |
| Looks for groups from the list of DN's passed. More...
|
|
| searchActiveDirectory ($dn) |
| Searches LDAP using a ActiveDirectory specific filter, looking for group membership for the users DN. More...
|
|
| getLdap () |
| Getter for the LDAP connection object. More...
|
|
| var_export ($value) |
| Local utility function to get details about a variable, basically converting it to a string to be used in a log message. More...
|
|
Definition at line 11 of file AttributeAddUsersGroups.php.
◆ getGroups()
sspmod_ldap_Auth_Process_AttributeAddUsersGroups::getGroups |
( |
array |
$attributes | ) |
|
|
protected |
This section of code was broken out because the child filter AuthorizeByGroup can use this method as well.
Based on the LDAP product, it will do an optimized search using the required attribute values from the user to get their group membership, recursively.
- Exceptions
-
- Parameters
-
- Returns
- array
Definition at line 76 of file AttributeAddUsersGroups.php.
References sspmod_ldap_Auth_Process_BaseFilter\$attribute_map, array, SimpleSAML\Logger\debug(), sspmod_ldap_Auth_Process_BaseFilter\getLdap(), search(), searchActiveDirectory(), and sspmod_ldap_Auth_Process_BaseFilter\var_export().
Referenced by process().
83 $this->title .
'Checking for groups based on the best method for the LDAP product.' 88 switch ($this->product) {
90 case 'ACTIVEDIRECTORY':
94 $this->title .
'Searching LDAP using ActiveDirectory specific method.' 100 $this->title .
'The DN attribute [' . $map[
'dn'] .
101 '] is not defined in the users Attributes: ' . implode(
', ', array_keys(
$attributes))
108 $this->title .
'The DN attribute [' . $map[
'dn'] .
120 $this->title .
'Searching LDAP using OpenLDAP specific method.' 123 $openldap_base = $this->config->getString(
'ldap.basedn',
'ou=groups,dc=example,dc=com');
125 $this->title .
"Searching for groups in ldap.basedn ".$openldap_base.
" with filter (".$map[
'memberof'].
"=".
$attributes[$map[
'username']][0].
") and attributes ".$map[
'member']
130 $all_groups = $this->
getLdap()->searchformultiple( $openldap_base,
array($map[
'memberof'] =>
$attributes[$map[
'username']][0]) ,
array($map[
'member']));
135 foreach ($all_groups as $group_entry) {
136 $groups[] .= $group_entry[$map[
'member']][0];
144 $this->title .
'Searching LDAP using the default search method.' 150 $this->title .
'The memberof attribute [' . $map[
'memberof'] .
151 '] is not defined in the users Attributes: ' . implode(
', ', array_keys(
$attributes))
158 $this->title .
'The memberof attribute [' . $map[
'memberof'] .
169 $this->title .
'User found to be a member of the groups:' . implode(
'; ', $groups)
searchActiveDirectory($dn)
Searches LDAP using a ActiveDirectory specific filter, looking for group membership for the users DN...
var_export($value)
Local utility function to get details about a variable, basically converting it to a string to be use...
Create styles array
The data for the language used.
getLdap()
Getter for the LDAP connection object.
search($memberof)
Looks for groups from the list of DN's passed.
◆ process()
sspmod_ldap_Auth_Process_AttributeAddUsersGroups::process |
( |
& |
$request | ) |
|
This is run when the filter is processed by SimpleSAML.
It will attempt to find the current users groups using the best method possible for the LDAP product. The groups are then added to the request attributes.
- Exceptions
-
- Parameters
-
Definition at line 22 of file AttributeAddUsersGroups.php.
References sspmod_ldap_Auth_Process_BaseFilter\$attribute_map, $attributes, array, SimpleSAML\Logger\debug(), getGroups(), and sspmod_ldap_Auth_Process_BaseFilter\var_export().
24 assert(
'is_array($request)');
25 assert(
'array_key_exists("Attributes", $request)');
29 $this->title .
'Attempting to get the users groups...' 47 $this->title .
'The group attribute [' . $map[
'groups'] .
54 $group_attribute = array_merge($group_attribute, $groups);
55 $group_attribute = array_unique($group_attribute);
59 $this->title .
'Added users groups to the group attribute [' .
60 $map[
'groups'] .
']: ' . implode(
'; ', $groups)
var_export($value)
Local utility function to get details about a variable, basically converting it to a string to be use...
Create styles array
The data for the language used.
getGroups(array $attributes)
This section of code was broken out because the child filter AuthorizeByGroup can use this method as ...
◆ search()
sspmod_ldap_Auth_Process_AttributeAddUsersGroups::search |
( |
|
$memberof | ) |
|
|
protected |
Looks for groups from the list of DN's passed.
Also recursively searches groups for further membership. Avoids loops by only searching a DN once. Returns the list of groups found.
- Parameters
-
- Returns
- array
Definition at line 184 of file AttributeAddUsersGroups.php.
References sspmod_ldap_Auth_Process_BaseFilter\$attribute_map, $attributes, array, SimpleSAML\Logger\debug(), and sspmod_ldap_Auth_Process_BaseFilter\getLdap().
Referenced by getGroups().
186 assert(
'is_array($memberof)');
189 static $searched =
array();
199 $this->title .
'Checking DNs for groups.' .
200 ' DNs: '. implode(
'; ', $memberof) .
201 ' Attributes: ' . $map[
'memberof'] .
', ' . $map[
'type'] .
202 ' Group Type: ' . $this->type_map[
'group']
206 foreach ($memberof as $dn) {
209 if (isset($searched[$dn])) {
215 $searched[$dn] = $dn;
225 if (!in_array($this->type_map[
'group'],
$attributes[$map[
'type']],
true)) {
237 return array_unique($groups);
Create styles array
The data for the language used.
getLdap()
Getter for the LDAP connection object.
search($memberof)
Looks for groups from the list of DN's passed.
◆ searchActiveDirectory()
sspmod_ldap_Auth_Process_AttributeAddUsersGroups::searchActiveDirectory |
( |
|
$dn | ) |
|
|
protected |
Searches LDAP using a ActiveDirectory specific filter, looking for group membership for the users DN.
Returns the list of group DNs retrieved.
- Parameters
-
- Returns
- array
Definition at line 249 of file AttributeAddUsersGroups.php.
References sspmod_ldap_Auth_Process_BaseFilter\$attribute_map, array, SimpleSAML\Logger\debug(), sspmod_ldap_Auth_Process_BaseFilter\getLdap(), SimpleSAML\Logger\notice(), and sspmod_ldap_Auth_Process_BaseFilter\var_export().
Referenced by getGroups().
251 assert(
'is_string($dn) && $dn != ""');
258 $this->title .
'Searching ActiveDirectory group membership.' .
260 ' DN Attribute: ' . $map[
'dn'] .
261 ' Member Attribute: ' . $map[
'member'] .
262 ' Type Attribute: ' . $map[
'type'] .
263 ' Type Value: ' . $this->type_map[
'group'] .
264 ' Base: ' . implode(
'; ', $this->base_dn)
268 $this->
getLdap()->setOption(LDAP_OPT_REFERRALS, 0);
272 $entries = $this->
getLdap()->searchformultiple(
274 array($map[
'type'] => $this->type_map[
'group'], $map[
'member'] .
':1.2.840.113556.1.4.1941:' => $dn),
288 foreach ($entries as $entry) {
291 if (isset($entry[$map[
'dn']][0])) {
292 $groups[] = $entry[$map[
'dn']][0];
297 if (isset($entry[strtolower($map[
'dn'])][0])) {
298 $groups[] = $entry[strtolower($map[
'dn'])][0];
303 if (isset($entry[
'dn'])) {
304 $groups[] = $entry[
'dn'];
310 $this->title .
'The DN attribute [' .
311 implode(
', ',
array($map[
'dn'], strtolower($map[
'dn']),
'dn')) .
312 '] could not be found in the entry. ' . $this->
var_export($entry)
var_export($value)
Local utility function to get details about a variable, basically converting it to a string to be use...
Create styles array
The data for the language used.
getLdap()
Getter for the LDAP connection object.
The documentation for this class was generated from the following file: