public function applySecurityRules(bool $secure = false, bool $httponly = false)
    {
        $nb_engine = CNabuEngine::getEngine();

        $attrs = session_get_cookie_params();
        session_set_cookie_params(
            $attrs['lifetime'],
            $attrs['path'],
            $attrs['domain'],
            $secure || $attrs['secure'],
            $httponly || (array_key_exists('httponly', $attrs) && $attrs['httponly'])
        );

        session_start();
        $nb_engine->traceLog("Session ID", session_id());

        $this->purgeNonce();

        if (isset($_SESSION) && count($_SESSION) > 0) {
            foreach ($_SESSION as $value) {
                if ($value instanceof INabuDBObject && !$value->isBuiltIn()) {
                    $value->relinkDB();
                }
            }
        }
    }