public function triggerLogin($config)
    {
        $headers = [
            'WWW-Authenticate: Basic realm="' . $config->RealmName . '"',
            'HTTP/1.0 401 Unauthorized'
        ];

        foreach ($headers as $h) {
            header($h);
        }

        if ($this->httpSession()->get('login_retry') == 'true') {
            $this->httpSession()->delete('login_retry');
            $this->triggerExit();
        }

        // once we get the username and password, we store them into the session and redirect to login submit path
        if ($this->httpRequest()->server()->get(self::USERNAME, '') != '' && $this->httpSession()->get('logout', 'false'
            ) != 'true'
        ) {
            // php Basic HTTP auth
            $username = $this->httpRequest()->server()->get(self::USERNAME);
            $password = $this->httpRequest()->server()->get(self::PASSWORD);
        } else {
            $this->httpSession()->delete('logout');
            $this->triggerExit();
        }

        $this->httpSession()->save('username', $username);
        $this->httpSession()->save('password', $password);

        $this->httpRedirect($this->httpRequest()->getCurrentUrl());
    }