Blame view

src/Controller/Component/LdapAuthComponent.php 954 Bytes
e1f6c5b7   Alexandre   Version: 2.3.0.0
1
2
3
4
<?php
namespace App\Controller\Component;

use Cake\Controller\Component\AuthComponent;
907bf7ec   Etienne Pallier   inutile
5
use Cake\Core\Exception\Exception;
e1f6c5b7   Alexandre   Version: 2.3.0.0
6
7
use Cake\ORM\TableRegistry;

63c3cb16   epallier   Nombreux petits b...
8
9
class LdapAuthComponent extends AuthComponent
{
e1f6c5b7   Alexandre   Version: 2.3.0.0
10

63c3cb16   epallier   Nombreux petits b...
11
12
13
    public function connection()
    {
        try {
2050f6d1   Etienne Pallier   mis à jour LDAP c...
14
            // Get login and password entered by the current user (who is trying to connect)
63c3cb16   epallier   Nombreux petits b...
15
16
            $login = $this->request->getData('ldap');
            $password = $this->request->getData('password');
a3d0275a   Etienne Pallier   Plein de petites ...
17
            // return user or FALSE
aa52e447   Etienne Pallier   amelioration ldap...
18
            // calls src/Model/Table/LdapConnectionsTable.php/ldapAuthentication()
091b1d3d   Etienne Pallier   ldap bugfix en ur...
19
            return TableRegistry::getTableLocator()->get('LdapConnections')->ldapAuthentication($login, $password);
a3d0275a   Etienne Pallier   Plein de petites ...
20
            //return TableRegistry::get('LdapConnections')->ldapAuthentication($login, $password);
63c3cb16   epallier   Nombreux petits b...
21
        } catch (Exception $e) {
091b1d3d   Etienne Pallier   ldap bugfix en ur...
22
23
24
            var_dump($e->getMessage());
            //return $e->getMessage();
            return FALSE;
63c3cb16   epallier   Nombreux petits b...
25
26
        }
    }
e1f6c5b7   Alexandre   Version: 2.3.0.0
27
28
}
?>