*/ class LSauthHTTP extends LSauth { var $params = array ( 'displayLoginForm' => false, 'displayLogoutBtn' => false ); /** * Check Post Data * * @retval array|False Array of post data if exist or False **/ public function getPostData() { if (isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER'])) { $this -> authData = array( 'username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW'], 'ldapserver' => $_REQUEST['LSsession_ldapserver'], 'topDn' => $_REQUEST['LSsession_topDn'] ); return true; } return; } /** * Check user login * * @param[in] $username The username * @param[in] $password The password * * @retval LSldapObject|false The LSldapObject of the user authificated or false */ public function authenticate() { if (LSsession :: loadLSobject(LSsession :: $ldapServer['authObjectType'])) { $authobject = new LSsession :: $ldapServer['authObjectType'](); $result = $authobject -> searchObject( $this -> authData['username'], LSsession :: getTopDn(), LSsession :: $ldapServer['authObjectFilter'] ); $nbresult=count($result); if ($nbresult==0) { // identifiant incorrect LSdebug('identifiant incorrect'); LSerror :: addErrorCode('LSauth_01'); } else if ($nbresult>1) { // duplication d'authentité LSerror :: addErrorCode('LSauth_02'); } else { // Authentication succeeded return $result[0]; } } else { LSerror :: addErrorCode('LSauth_03'); } return; } } ?>