LP1840773 Auth logout broadcast honors auth domain
authorBill Erickson <berickxx@gmail.com>
Thu, 7 Jul 2022 15:38:33 +0000 (11:38 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 7 Jul 2022 15:38:33 +0000 (11:38 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/core/auth.service.ts

index f549cba..1a9310c 100644 (file)
@@ -224,10 +224,12 @@ export class AuthService {
                 `received eg.auth broadcast ${JSON.stringify(e.data)}`);
 
             if (e.data.action === 'logout') {
-                // Logout will be handled by the originating tab.
-                // We just need to clear tab-local memory.
-                this.cleanup();
-                this.net.authExpired$.emit({viaExternal: true});
+                if (!e.data.domain || e.data.domain === this.authDomain) {
+                    // Logout will be handled by the originating tab.
+                    // We just need to clear tab-local memory.
+                    this.cleanup();
+                    this.net.authExpired$.emit({viaExternal: true});
+                }
             }
         };
     }
@@ -325,7 +327,7 @@ export class AuthService {
     // This should only be invoked by one tab.
     broadcastLogout(): void {
         console.debug('Notifying tabs of imminent auth token removal');
-        this.authChannel.postMessage({action : 'logout'});
+        this.authChannel.postMessage({action : 'logout', domain: this.authDomain});
     }
 
     // Remove/reset session data