ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
sspmod_ldap_Auth_Source_LDAPMulti Class Reference
+ Inheritance diagram for sspmod_ldap_Auth_Source_LDAPMulti:
+ Collaboration diagram for sspmod_ldap_Auth_Source_LDAPMulti:

Public Member Functions

 __construct ($info, $config)
 Constructor for this authentication source. More...
 
- Public Member Functions inherited from sspmod_core_Auth_UserPassOrgBase
 __construct ($info, &$config)
 Constructor for this authentication source. More...
 
 getUsernameOrgMethod ()
 Retrieve the way organizations as part of the username should be handled. More...
 
 getRememberUsernameEnabled ()
 Getter for the authsource config option remember.username.enabled. More...
 
 getRememberUsernameChecked ()
 Getter for the authsource config option remember.username.checked. More...
 
 authenticate (&$state)
 Initialize login. More...
 
- Public Member Functions inherited from SimpleSAML_Auth_Source
 __construct ($info, &$config)
 Constructor for an authentication source. More...
 
 getAuthId ()
 Retrieve the ID of this authentication source. More...
 
 authenticate (&$state)
 Process a request. More...
 
 reauthenticate (array &$state)
 Reauthenticate an user. More...
 
 initLogin ($return, $errorURL=null, array $params=array())
 Start authentication. More...
 
 logout (&$state)
 Log out from this authentication source. More...
 

Protected Member Functions

 login ($username, $password, $org, array $sasl_args=null)
 Attempt to log in using the given username and password. More...
 
 getOrganizations ()
 Retrieve list of organizations. More...
 
- Protected Member Functions inherited from sspmod_core_Auth_UserPassOrgBase
 setUsernameOrgMethod ($usernameOrgMethod)
 Configure the way organizations as part of the username is handled. More...
 
 login ($username, $password, $organization)
 Attempt to log in using the given username, password and organization. More...
 
 getOrganizations ()
 Retrieve list of organizations. More...
 
- Protected Member Functions inherited from SimpleSAML_Auth_Source
 addLogoutCallback ($assoc, $state)
 Add a logout callback association. More...
 
 callLogoutCallback ($assoc)
 Call a logout callback based on association. More...
 

Private Attributes

 $orgs
 An array with descriptions for organizations. More...
 
 $ldapOrgs
 An array of organization IDs to LDAP configuration objects. More...
 
 $includeOrgInUsername
 Whether we should include the organization as part of the username. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sspmod_core_Auth_UserPassOrgBase
static handleLogin ($authStateId, $username, $password, $organization)
 Handle login request. More...
 
static listOrganizations ($authStateId)
 Get available organizations. More...
 
- Static Public Member Functions inherited from SimpleSAML_Auth_Source
static getSourcesOfType ($type)
 Get sources of a specific type. More...
 
static completeAuth (&$state)
 Complete authentication. More...
 
static loginCompleted ($state)
 Called when a login operation has finished. More...
 
static completeLogout (&$state)
 Complete logout. More...
 
static getById ($authId, $type=null)
 Retrieve authentication source. More...
 
static logoutCallback ($state)
 Called when the authentication source receives an external logout request. More...
 
static getSources ()
 Retrieve list of authentication sources. More...
 
- Data Fields inherited from sspmod_core_Auth_UserPassOrgBase
const STAGEID = 'sspmod_core_Auth_UserPassOrgBase.state'
 The string used to identify our states. More...
 
const AUTHID = 'sspmod_core_Auth_UserPassOrgBase.AuthId'
 The key of the AuthId field in the state. More...
 
const ORGID = 'sspmod_core_Auth_UserPassOrgBase.SelectedOrg'
 The key of the OrgId field in the state, identifies which org was selected. More...
 
- Static Protected Member Functions inherited from SimpleSAML_Auth_Source
static validateSource ($source, $id)
 Make sure that the first element of an auth source is its identifier. More...
 
- Protected Attributes inherited from sspmod_core_Auth_UserPassOrgBase
 $rememberUsernameEnabled = FALSE
 
 $rememberUsernameChecked = FALSE
 
- Protected Attributes inherited from SimpleSAML_Auth_Source
 $authId
 

Detailed Description

Definition at line 13 of file LDAPMulti.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_ldap_Auth_Source_LDAPMulti::__construct (   $info,
  $config 
)

Constructor for this authentication source.

Parameters
array$infoInformation about this authentication source.
array$configConfiguration.

Definition at line 38 of file LDAPMulti.php.

References $config, $info, $name, sspmod_core_Auth_UserPassOrgBase\$usernameOrgMethod, SimpleSAML_Configuration\loadFromArray(), and sspmod_core_Auth_UserPassOrgBase\setUsernameOrgMethod().

39  {
40  assert(is_array($info));
41  assert(is_array($config));
42 
43  // Call the parent constructor first, as required by the interface
44  parent::__construct($info, $config);
45 
47  'Authentication source ' . var_export($this->authId, true));
48 
49 
50  $this->orgs = array();
51  $this->ldapOrgs = array();
52  foreach ($config as $name => $value) {
53 
54  if ($name === 'username_organization_method') {
55  $usernameOrgMethod = $cfgHelper->getValueValidate(
56  'username_organization_method',
57  array('none', 'allow', 'force'));
59  continue;
60  }
61 
62  if ($name === 'include_organization_in_username') {
63  $this->includeOrgInUsername = $cfgHelper->getBoolean(
64  'include_organization_in_username', false);
65  continue;
66  }
67 
68  $orgCfg = $cfgHelper->getArray($name);
69  $orgId = $name;
70 
71  if (array_key_exists('description', $orgCfg)) {
72  $this->orgs[$orgId] = $orgCfg['description'];
73  } else {
74  $this->orgs[$orgId] = $orgId;
75  }
76 
77  $orgCfg = new sspmod_ldap_ConfigHelper($orgCfg,
78  'Authentication source ' . var_export($this->authId, true) .
79  ', organization ' . var_export($orgId, true));
80  $this->ldapOrgs[$orgId] = $orgCfg;
81  }
82  }
$config
Definition: bootstrap.php:15
setUsernameOrgMethod($usernameOrgMethod)
Configure the way organizations as part of the username is handled.
$usernameOrgMethod
What way do we handle the organization as part of the username.
$info
Definition: index.php:5
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
+ Here is the call graph for this function:

Member Function Documentation

◆ getOrganizations()

sspmod_ldap_Auth_Source_LDAPMulti::getOrganizations ( )
protected

Retrieve list of organizations.

Returns
array Associative array with the organizations.

Definition at line 120 of file LDAPMulti.php.

References $orgs.

121  {
122  return $this->orgs;
123  }
$orgs
An array with descriptions for organizations.
Definition: LDAPMulti.php:19

◆ login()

sspmod_ldap_Auth_Source_LDAPMulti::login (   $username,
  $password,
  $org,
array  $sasl_args = null 
)
protected

Attempt to log in using the given username and password.

Parameters
string$usernameThe username the user wrote.
string$passwordThe password the user wrote.
string$orgThe organization the user chose.
Returns
array Associative array with the users attributes.

Definition at line 93 of file LDAPMulti.php.

References $password, and SimpleSAML\Logger\warning().

94  {
95  assert(is_string($username));
96  assert(is_string($password));
97  assert(is_string($org));
98 
99  if (!array_key_exists($org, $this->ldapOrgs)) {
100  // The user has selected an organization which doesn't exist anymore.
101  SimpleSAML\Logger::warning('Authentication source ' . var_export($this->authId, true) .
102  ': Organization seems to have disappeared while the user logged in.' .
103  ' Organization was ' . var_export($org, true));
104  throw new SimpleSAML_Error_Error('WRONGUSERPASS');
105  }
106 
107  if ($this->includeOrgInUsername) {
108  $username = $username . '@' . $org;
109  }
110 
111  return $this->ldapOrgs[$org]->login($username, $password, $sasl_args);
112  }
static warning($string)
Definition: Logger.php:177
$password
Definition: cron.php:14
+ Here is the call graph for this function:

Field Documentation

◆ $includeOrgInUsername

sspmod_ldap_Auth_Source_LDAPMulti::$includeOrgInUsername
private

Whether we should include the organization as part of the username.

Definition at line 29 of file LDAPMulti.php.

◆ $ldapOrgs

sspmod_ldap_Auth_Source_LDAPMulti::$ldapOrgs
private

An array of organization IDs to LDAP configuration objects.

Definition at line 24 of file LDAPMulti.php.

◆ $orgs

sspmod_ldap_Auth_Source_LDAPMulti::$orgs
private

An array with descriptions for organizations.

Definition at line 19 of file LDAPMulti.php.

Referenced by getOrganizations().


The documentation for this class was generated from the following file: