LdapAuthComponent.php 463 Bytes
<?php
namespace App\Controller\Component;

use Cake\Controller\Component\AuthComponent;
use Cake\ORM\TableRegistry;

class LdapAuthComponent extends AuthComponent {


	public function connection() {
		try {	
			$login = $this->request->data['ldap'];
			$password = $this->request->data['password']; 
			
			return TableRegistry::get('LdapConnections')->ldapAuthentication($login, $password);	
		}
		catch(Exception $e) {
			return $e->getMessage();
		}
	}
	

}
?>