Bug 2005206 - OS session event detection + logout#422
Draft
gcp wants to merge 6 commits intoenterprise-mainfrom
Draft
Bug 2005206 - OS session event detection + logout#422gcp wants to merge 6 commits intoenterprise-mainfrom
gcp wants to merge 6 commits intoenterprise-mainfrom
Conversation
cc02111 to
16c8432
Compare
Define NS_WIDGET_OS_SESSION_END_OBSERVER_TOPIC, NS_WIDGET_OS_USER_SWITCH_OBSERVER_TOPIC, and NS_WIDGET_SCREEN_LOCKED_OBSERVER_TOPIC in nsIWidget.h, following the existing pattern of sleep/wake observer topics.
Extend WinEventObserver to register for session notifications via WTSRegisterSessionNotification, and fire screen-locked on WTS_SESSION_LOCK and os-user-switch on WTS_CONSOLE_DISCONNECT. Fire os-session-end in the WM_ENDSESSION handler in nsWindow.cpp before the shutdown sequence begins, for logoff and OS shutdown events.
Register NSWorkspace notification observers in AppShellDelegate for SessionDidResignActive (os-user-switch), WillPowerOff (os-session-end), and ScreensDidSleep (screen-locked). Fire os-session-end in MacApplicationDelegate's applicationShouldTerminate: before quit-application-requested to catch OS-initiated termination.
Extend DBusSessionSleepCallback to handle PrepareForShutdown signal from login1.Manager, firing os-session-end. Add login1.Session proxy to monitor the Active property for user switching (os-user-switch), and org.freedesktop.ScreenSaver proxy to listen for ActiveChanged signal (screen-locked). The session proxy must be created on the real session object path (e.g. /org/freedesktop/login1/session/_33) rather than the "auto" convenience alias, because PropertiesChanged signals are only emitted on the real path. When the login1 Manager proxy is ready, we resolve the real path via GetSession(XDG_SESSION_ID) or GetSessionByPID as a fallback, then create the session proxy on the resolved path. Update DBusConnectClientResponse to dispatch by interface name to support the new proxies alongside the existing ones.
New module that listens for os-session-end, os-user-switch, and screen-locked observer topics and triggers the enterprise sign-out flow. os-session-end always signs out. os-user-switch is controlled by the enterprise.signoutOnUserSwitch pref (default: true). screen-locked is controlled by the enterprise.signoutOnScreenLock pref (default: false). The sign-out flow performs best-effort server-side token revocation before clearing local tokens and handing off to FELT. The cleanup steps are wrapped in try/finally to ensure quit() always executes. Also add a .catch() handler to the rejected promise in EnterpriseStorageManager.deleteAccountData() to prevent unhandled rejection warnings during sign-out.
Integration tests covering all OS event scenarios: os-session-end triggers signout unconditionally, os-user-switch respects pref, screen-locked respects pref, and server-side logout is called. Events are simulated via Services.obs.notifyObservers from chrome context, exercising the full EnterpriseSessionObserver flow.
16c8432 to
56b772c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.