Skip to content

Commit

Permalink
Check for Symfony's saslBind and whoami method presence
Browse files Browse the repository at this point in the history
  • Loading branch information
manu0401 committed Oct 31, 2024
1 parent 7462d23 commit ab76145
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Connector/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public function bind(?string $username, #[\SensitiveParameter]?string $password)
public function saslBind(?string $username, #[\SensitiveParameter]?string $password, ?string $mech, ?string $realm, ?string $authcId, ?string $authzId, ?string $props): void

{
if (!method_exists($this->connection, 'saslBind'))
throw new Error\Error("SASL not implemented");

try {
$this->connection->saslBind($username, strval($password), $mech, $realm, $authcId, $authzId, $props);
} catch (InvalidCredentialsException $e) {
Expand All @@ -133,6 +136,9 @@ public function saslBind(?string $username, #[\SensitiveParameter]?string $passw
*/
public function whoami(): string
{
if (!method_exists($this->connection, 'whoami'))
throw new Error\Error("SASL not implemented");

return $this->connection->whoami();
}

Expand Down

0 comments on commit ab76145

Please sign in to comment.