Blame view

src/Controller/Component/LdapAuthComponent.php 1008 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

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