protected function parseFirewalls($force = false)
    {
        if (null == $this->firewalls || $force) {
            $firewalls = ['pattern'=>null,'paths'=>[]];
            $pattern = '';

            foreach (Base::instance()->get('SECURITY.firewalls') ?: [] as $name => $config) {
                $pattern .= ($pattern?'|':'').$config['path'];
                $key = static::pathName($config['path']);
                $firewalls['paths'][$key] = [
                    'login_route' => $config['login_route'],
                    'roles' => $config['roles'],
                ];
            }

            if ($pattern) {
                $firewalls['pattern'] = '#(?<path>'.$pattern.')#';
            }

            $this->firewalls = $firewalls;
        }
    }