Horde\ManageSieve::_cmdAuthenticate PHP Method

_cmdAuthenticate() protected method

Handles the authentication using any known method.
protected _cmdAuthenticate ( string $uid, string $pwd, string $authmethod = null, string $euser = '' )
$uid string The userid to authenticate as.
$pwd string The password to authenticate with.
$authmethod string The method to use. If empty, the class chooses the best (strongest) available method.
$euser string The effective uid to authenticate as.
    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);
        }
    }