1
0
forked from baron/baron-sso

자식 창 로그인 우선순위 조정

This commit is contained in:
2026-01-20 15:25:56 +09:00
parent 431e3a7e05
commit 4856801756

View File

@@ -391,22 +391,27 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
details: "User logged in via Baron SSO", details: "User logged in via Baron SSO",
); );
// 1. Handle Redirect Flow (Redirect to another app) // 1. Handle Popup Flow (Highest Priority for child windows)
if (_redirectUrl != null && _redirectUrl!.isNotEmpty) { // If opened as a popup (has opener), we notify and try to close.
final target = "$_redirectUrl?token=$token"; if (WebAuthIntegration.isPopup()) {
launchUrlString(target, webOnlyWindowName: '_self'); debugPrint("[Auth] Popup detected. Notifying opener and attempting to close.");
return; WebAuthIntegration.sendLoginSuccess(token);
// We don't 'return' here to allow a fallback if window.close() is blocked,
// but in most cases WebAuthIntegration.sendLoginSuccess will close the window.
} else {
// 2. Handle Redirect Flow (Only if NOT a popup)
if (_redirectUrl != null && _redirectUrl!.isNotEmpty) {
debugPrint("[Auth] Redirecting standalone window to: $_redirectUrl");
final target = "$_redirectUrl?token=$token";
launchUrlString(target, webOnlyWindowName: '_self');
return;
}
} }
// 2. Handle Popup Flow (Send message to opener) // 3. Standalone mode / Fallback
if (WebAuthIntegration.isPopup()) { // If it's a standard login, or if a popup's window.close() was blocked by the browser.
WebAuthIntegration.sendLoginSuccess(token); debugPrint("[Auth] Login success. Navigating to root.");
// If this window was truly a popup for another app, it should close now.
// If it's still here, we allow it to fall through to the dashboard.
}
// 3. Standalone mode: Go to dashboard
// We call notify() to update the router's state, and go() to ensure navigation.
AuthNotifier.instance.notify(); AuthNotifier.instance.notify();
if (mounted) { if (mounted) {
context.go('/'); context.go('/');