1 | <?php |
||
19 | class LdapAuthenticationProvider implements AuthenticationProviderInterface |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var Ldap The actual LDAP resource to call methods on |
||
24 | */ |
||
25 | private $ldap; |
||
26 | /** |
||
27 | * @var UserProviderInterface The instance of our LDAP User Provider |
||
28 | */ |
||
29 | private $user_provider; |
||
30 | |||
31 | /** |
||
32 | * LdapAuthenticationProvider constructor, set members. |
||
33 | * |
||
34 | * @param Ldap $ldap |
||
35 | * @param UserProviderInterface $user_provider |
||
36 | */ |
||
37 | public function __construct(Ldap $ldap, UserProviderInterface $user_provider) |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function authenticate(TokenInterface $token) |
||
56 | |||
57 | /** |
||
58 | * This method tries to authenticate the given user, the LDAP resource is then bound to this account. |
||
59 | * By calling `$ldap->bind()` (without parameters) afterwards, the resource is again bound to the privileged account. |
||
60 | * |
||
61 | * @param string $user The username to use for binding |
||
62 | * @param string $password The password to use for binding |
||
63 | * @return bool Returns true if the bind was successful, false otherwise. |
||
64 | */ |
||
65 | private function checkLogin($user, $password) |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function supports(TokenInterface $token) |
||
87 | } |