/** @dataProvider bindingWithPasswordProvider */ public function testThatBindingWithAddedSlashesFailsWorks($user, $password, $filter) { $newpassword = addslashes($password); require_once __DIR__ . '/../src/LdapList.php'; $ldaplist = new \Org_Heigl\AuthLdap\LdapList(); $ldaplist->addLdap(new LDAP('ldap://cn=Manager,dc=example,dc=com:insecure@127.0.0.1:3890/dc=example,dc=com')); if ($newpassword === $password) { $this->assertTrue($ldaplist->authenticate($user, $password, $filter)); } else { $this->assertFalse($ldaplist->authenticate($user, $newpassword, $filter)); } }
/** * get a LDAP server object * * throws exception if there is a problem connecting * * @conf boolean authLDAPDebug true, if debugging should be turned on * @conf string authLDAPURI LDAP server URI * * @return LDAP LDAP server object */ function authLdap_get_server() { static $_ldapserver = null; if (is_null($_ldapserver)) { $authLDAPDebug = authLdap_get_option('Debug'); $authLDAPURI = explode(authLdap_get_option('URISeparator', ' '), authLdap_get_option('URI')); $authLDAPStartTLS = authLdap_get_option('StartTLS'); //$authLDAPURI = 'ldap:/foo:bar@server/trallala'; authLdap_debug('connect to LDAP server'); require_once dirname(__FILE__) . '/src/LdapList.php'; $_ldapserver = new \Org_Heigl\AuthLdap\LdapList(); foreach ($authLDAPURI as $uri) { $_ldapserver->addLdap(new \Org_Heigl\AuthLdap\LDAP($uri, $authLDAPDebug, $authLDAPStartTLS)); } } return $_ldapserver; }