public static function getAdapter($key) {
        $config = Zend_Registry::get('config');
        if (!$config->auth || !$config->auth->adapters) {
            throw new Garp_Auth_Exception(self::EXCEPTION_NO_ADAPTERS_CONFIGURED);
        }

        $key = strtolower($key);
        if (!$config->auth->adapters->{$key}) {
            throw new Garp_Auth_Exception(sprintf(self::EXCEPTION_KEY_NOT_FOUND, $key));
        }

        $classKey = $config->auth->adapters->{$key}->class;
        if (!$classKey) {
            $classKey = $key;
        }
        $className = strpos($classKey, '_') === false ?
            self::AUTH_NAMESPACE . ucfirst($classKey) : $classKey;
        $obj = new $className();
        if (!$obj instanceof Garp_Auth_Adapter_Abstract) {
            throw new Garp_Auth_Exception(sprintf(self::EXCEPTION_INVALID_CLASS, $className));
        }
        return $obj;
    }