40 assert(
'is_array($info)');
41 assert(
'is_array($config)');
47 'Authentication source ' . var_export($this->authId,
true));
50 $this->orgs =
array();
51 $this->ldapOrgs =
array();
54 if (
$name ===
'username_organization_method') {
56 'username_organization_method',
57 array(
'none',
'allow',
'force'));
62 if (
$name ===
'include_organization_in_username') {
63 $this->includeOrgInUsername = $cfgHelper->getBoolean(
64 'include_organization_in_username',
false);
68 $orgCfg = $cfgHelper->getArray(
$name);
71 if (array_key_exists(
'description', $orgCfg)) {
72 $this->orgs[$orgId] = $orgCfg[
'description'];
74 $this->orgs[$orgId] = $orgId;
78 'Authentication source ' . var_export($this->authId,
true) .
79 ', organization ' . var_export($orgId,
true));
80 $this->ldapOrgs[$orgId] = $orgCfg;
95 assert(
'is_string($username)');
96 assert(
'is_string($password)');
97 assert(
'is_string($org)');
99 if (!array_key_exists($org, $this->ldapOrgs)) {
102 ': Organization seems to have disappeared while the user logged in.' .
103 ' Organization was ' . var_export($org,
true));
107 if ($this->includeOrgInUsername) {
108 $username = $username .
'@' . $org;
111 return $this->ldapOrgs[$org]->login($username,
$password, $sasl_args);
getOrganizations()
Retrieve list of organizations.
login($username, $password, $org, array $sasl_args=null)
Attempt to log in using the given username and password.
Create styles array
The data for the language used.
__construct($info, $config)
Constructor for this authentication source.
setUsernameOrgMethod($usernameOrgMethod)
Configure the way organizations as part of the username is handled.
$includeOrgInUsername
Whether we should include the organization as part of the username.
$orgs
An array with descriptions for organizations.
$usernameOrgMethod
What way do we handle the organization as part of the username.
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
$ldapOrgs
An array of organization IDs to LDAP configuration objects.