protected function _cmdAuthenticate($uid, $pwd, $authmethod = null, $euser = '')
{
$method = $this->_getBestAuthMethod($authmethod);
switch ($method) {
case self::AUTH_DIGESTMD5:
$this->_authDigestMD5($uid, $pwd, $euser);
return;
case self::AUTH_CRAMMD5:
$this->_authCRAMMD5($uid, $pwd, $euser);
break;
case self::AUTH_LOGIN:
$this->_authLOGIN($uid, $pwd, $euser);
break;
case self::AUTH_PLAIN:
$this->_authPLAIN($uid, $pwd, $euser);
break;
case self::AUTH_EXTERNAL:
$this->_authEXTERNAL($uid, $pwd, $euser);
break;
default:
throw new Exception($method . ' is not a supported authentication method');
break;
}
$this->_doCmd();
// Query the server capabilities again now that we are authenticated.
try {
$this->_cmdCapability();
} catch (Exception $e) {
throw new Exception\ConnectionFailed($e);
}
}