cdylib glue: seed the cdylib's protocol stack with the host auth token

The glue's init() reads the authToken property module_initializer now
surfaces on the LogosAPI object and forwards it across
logos_module_accept_token under the initializer's own keys
(core / capability_module). Without it the cdylib's TokenManager (a
separate static copy of the singleton) is empty and every outbound
call — including the capability requestModule bootstrap — is rejected
as unauthorized.
This commit is contained in:
Dario Gabriel Lipicar
2026-06-11 20:25:21 -03:00
parent 7a7c86fe41
commit 079bbc0ad3
@@ -543,6 +543,16 @@ QString lidlMakeCdylibGlueSource(const ModuleDecl& module)
s << " api->property(\"modulePath\").toString().toUtf8().constData(),\n";
s << " api->property(\"instanceId\").toString().toUtf8().constData(),\n";
s << " api->property(\"instancePersistencePath\").toString().toUtf8().constData());\n";
s << " // The cdylib runs its own protocol stack (a separate static copy with\n";
s << " // its own TokenManager). Seed it with the host-issued auth token the\n";
s << " // initializer surfaces as a property, under the same keys it uses\n";
s << " // (\"core\" / \"capability_module\") — this is what authenticates the\n";
s << " // module's OUTBOUND calls (incl. the capability requestModule flow).\n";
s << " const QString authToken = api->property(\"authToken\").toString();\n";
s << " if (!authToken.isEmpty()) {\n";
s << " logos_module_accept_token(\"core\", authToken.toUtf8().constData());\n";
s << " logos_module_accept_token(\"capability_module\", authToken.toUtf8().constData());\n";
s << " }\n";
s << "}\n";
return c;
}