Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Manager;
- use Symfony\Component\Config\Definition\Exception\Exception;
- class Ldap
- {
- protected $link;
- public function connect()
- {
- $host = $this->container->getParameter('ldap_host');
- $port = $this->container->getParameter('ldap_port');
- $this->link = @ldap_connect($host, $port );
- if (!$this->link)
- {
- throw $this->createNotFoundException('Le serveur ldap ne repond pas');
- }
- }
- public function bind()
- {
- $username = $this->container->getParameter('ldap_rdn');
- $password = $this->container->getParameter('ldap_pass');
- if (@ldap_bind($this->link, $username, $password))
- {
- return $this;
- } else {
- throw $this->createNotFoundException('Authentification Ldap failed');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement