/** * Logins using the backend's Logon function. * * @param IBackend $backend * @param String $incomingXml * @access private * @throws AuthenticationRequiredException if no login data was sent. * * @return string $username */ private function login($backend, $incomingXml) { // Determine the login name depending on the configuration: complete email address or // the local part only. if (USE_FULLEMAIL_FOR_LOGIN) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("Using the complete email address for login.")); $username = $incomingXml->Request->EMailAddress; } else { ZLog::Write(LOGLEVEL_DEBUG, sprintf("Using the username only for login.")); $username = Utils::GetLocalPartFromEmail($incomingXml->Request->EMailAddress); } if ($backend->Logon($username, "", $_SERVER['PHP_AUTH_PW']) == false) { throw new AuthenticationRequiredException("Access denied. Username or password incorrect."); } ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPushAutodiscover->login() Using '%s' as the username.", $username)); return $username; }