: asapien/signet

commit 7eebccdbe852ed25a418d3ee942bf893cb0c3695
parent 50603d9219d75d81fefcc8428bd77700c81d8456
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Mon, 30 Nov 2026 00:52:19 +0530

Reuse shared SSO account menu and logout in Signet
2 files changed, 18 insertions(+), 1 deletion(-)
M
README.md
|
9
+++++++++
M
www/app.js
|
10
+++++++++-
diff --git a/README.md b/README.md
@@ -157,6 +157,15 @@ identity and maps configured groups to roles. Both forwarded groups and role
 configuration use comma-separated complete names: `Counter Staff, Manager` is
 two groups, not three whitespace-separated words. Matching is case-sensitive.
 
+On non-loopback deployments, the account menu reuses the same deployment-owned
+ES module as Movements, served same-origin at `/js/auth-ui.js` (on maa-1,
+lighttpd aliases `/js/` to `/etc/lighttpd/js/`). It must register
+`<sso-user-button>` and own the provider logout URL; do not copy it into Signet.
+Open the username menu and choose **Sign Out** to use the provider's logout page.
+This ends the shared SSO session, not just access to Signet. If the module cannot
+load, Signet retains the username/roles and reports unavailable account controls.
+Loopback development keeps its test-identity clearing link without loading SSO UI.
+
 ## Develop / test
 
 ```sh
diff --git a/www/app.js b/www/app.js
@@ -921,7 +921,15 @@ async function boot() {
   }
   document.getElementById('signature-nav').hidden = !app.me.roles.signer;
   const who = document.getElementById('whoami');
-  who.textContent = app.me.user + ' · ' + Object.entries(app.me.roles).filter(([, v]) => v).map(([k]) => k).join(', ');
+  const roles = Object.entries(app.me.roles).filter(([, v]) => v).map(([k]) => k).join(', ');
+  who.textContent = app.me.user + ' · ' + roles;
+  if (!LOCAL_DEV) {
+    // Same deployment-owned account menu as Movements; no provider session in Signet.
+    import('/js/auth-ui.js').then(() => {
+      who.replaceChildren(h('span', {}, roles), ' ',
+        h('sso-user-button', { username: app.me.user, 'logout-label': 'Sign Out' }));
+    }).catch(() => toast('Account controls unavailable. Reload to try again.', true));
+  }
   if (LOCAL_DEV && localStorage.getItem('signetDevIdentity')) {
     who.append(' ', h('a', { href: '#', onclick: (e) => { e.preventDefault(); localStorage.removeItem('signetDevIdentity'); location.reload(); } }, '(clear test identity)'));
   }