View | Details | Raw Unified | Return to bug 52278
Collapse All | Expand All

(-)saml/univention-saml/simplesamlphp/modules/uldap/lib/Auth/Source/uLDAP.php (-5 / +10 lines)
 Lines 16-22   class sspmod_uldap_Auth_Source_uLDAP extends sspmod_core_Auth_UserPassBase { Link Here 
16
	 * A LDAP configuration object.
16
	 * A LDAP configuration object.
17
	 */
17
	 */
18
	private $ldapConfig;
18
	private $ldapConfig;
19
	private $ldap;
19
	private static $_ldap = NULL;
20
	private $config;
20
	private $config;
21
21
22
22
 Lines 35-45   class sspmod_uldap_Auth_Source_uLDAP extends sspmod_core_Auth_UserPassBase { Link Here 
35
35
36
		$this->ldapConfig = new sspmod_ldap_ConfigHelper($config,
36
		$this->ldapConfig = new sspmod_ldap_ConfigHelper($config,
37
			'Authentication source ' . var_export($this->authId, TRUE));
37
			'Authentication source ' . var_export($this->authId, TRUE));
38
		$this->ldap = new SimpleSAML_Auth_LDAP($config['hostname'], $config['enable_tls'], $config['debug'], $config['timeout']);
39
		$this->ldap->bind($config['search.username'], $config['search.password']);
40
		$this->config = $config;
38
		$this->config = $config;
41
	}
39
	}
42
40
41
	private function ldap() {
42
		if (self::$_ldap === NULL) {
43
			self::$_ldap = new SimpleSAML_Auth_LDAP($config['hostname'], $config['enable_tls'], $config['debug'], $config['timeout']);
44
			self::$_ldap->bind($config['search.username'], $config['search.password']);
45
		}
46
		return self::$_ldap;
47
	}
43
48
44
	/**
49
	/**
45
	 * Attempt to log in using the given username and password.
50
	 * Attempt to log in using the given username and password.
 Lines 71-78   class sspmod_uldap_Auth_Source_uLDAP extends sspmod_core_Auth_UserPassBase { Link Here 
71
				$expired_messages = array("password expired", "The password has expired.", "account expired");
76
				$expired_messages = array("password expired", "The password has expired.", "account expired");
72
				if (in_array($this->ldapConfig->extended_error, $expired_messages)) {
77
				if (in_array($this->ldapConfig->extended_error, $expired_messages)) {
73
					SimpleSAML\Logger::debug('password is expired, checking for password change');
78
					SimpleSAML\Logger::debug('password is expired, checking for password change');
74
					$user_dn = $this->ldap->searchfordn($this->config['search.base'], $this->config['search.attributes'], $username, TRUE);
79
					$user_dn = $this->ldap()->searchfordn($this->config['search.base'], $this->config['search.attributes'], $username, TRUE);
75
					$attributes = $this->ldap->getAttributes($user_dn);
80
					$attributes = $this->ldap()->getAttributes($user_dn);
76
					$this->throw_common_login_errors($attributes);
81
					$this->throw_common_login_errors($attributes);
77
				}
82
				}
78
			}
83
			}

Return to bug 52278