Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Apr 7, 2024
1 parent 7e700e5 commit a46ec9a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"simplesamlphp/simplesamlphp": "^2.2",
"simplesamlphp/simplesamlphp-module-ldap": "^2.2",
"symfony/http-foundation": "^6.4",
"symfony/ldap": "^6.4"
"symfony/ldap": "^6.4",
"symfony/security-core": "^6.4"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "^1.6.0"
Expand Down
4 changes: 3 additions & 1 deletion src/Auth/Source/X509userCert.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use SimpleSAML\Utils;
use SimpleSAML\XHTML\Template;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Ldap;
use Symfony\Component\Ldap\Security\LdapUserProvider;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;

Expand Down Expand Up @@ -279,9 +280,10 @@ public function findUserByAttribute(string $attr, string $value): ?Entry
Assert::nullOrnotWhitespaceOnly($searchPassword);

$ldap = ConnectorFactory::fromAuthSource($this->backend);
$connection = new Ldap($ldap->getAdapter());

foreach ($searchBase as $base) {
$ldapUserProvider = new LdapUserProvider($ldap, $base, $searchUsername, $searchPassword, [], $attr);
$ldapUserProvider = new LdapUserProvider($connection, $base, $searchUsername, $searchPassword, [], $attr);
try {
return $ldapUserProvider->loadUserByIdentifier($value)->getEntry();
} catch (UserNotFoundException $e) {
Expand Down
3 changes: 1 addition & 2 deletions tools/composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"symbol-whitelist": [
"SimpleSAML\\Module\\ldap\\ConfigHelper",
"SimpleSAML\\Module\\ldap\\ConnectorFactory",
"SimpleSAML\\Module\\ldap\\ConnectorInterface",
"Symfony\\Component\\Security\\Core\\Exception\\UserNotFoundException"
"SimpleSAML\\Module\\ldap\\ConnectorInterface"
]
}

0 comments on commit a46ec9a

Please sign in to comment.