/* * Virtual OpenJDK 11 `jaas` library for CheerpJ Workplace. * JDK UnixSystem() calls System.loadLibrary("jaas") followed by native * getUnixInfo(). This module supplies only that native method and delegates * protected-field initialization to our unsigned, non-vendor Java helper. * * Not an authentication provider: users must still authenticate to iTAC MES. * This handler is registered with cheerpjInit({natives}) in addition to being * exported as a System.loadLibrary("jaas") module. Registering the method * does not itself make JVM_LoadLibrary available in the CheerpJ runtime. */ export default { async Java_com_sun_security_auth_module_UnixSystem_getUnixInfo(lib, self) { if (!lib || !self) { throw new Error('CheerpJ JAAS bridge: missing native context'); } const helper = await lib.com.widgetworkbench.cheerpj.JaasIdentityBridge; if (!helper || typeof helper.populate !== 'function') { throw new Error('CheerpJ JAAS bridge JAR is not on the Workplace classpath'); } console.info('[WidgetWorkbench/JAAS] UnixSystem.getUnixInfo native invoked'); const username = await helper.populate(self); if (username !== 'cheerpj-client') { throw new Error('CheerpJ JAAS bridge returned an unexpected identity'); } }, };