forked from baron/baron-sso
userfront 연동이력 맞춤
This commit is contained in:
@@ -10,7 +10,7 @@ import '../../../core/services/auth_proxy_service.dart';
|
||||
import '../../../core/services/auth_token_store.dart';
|
||||
import '../../../core/notifiers/auth_notifier.dart';
|
||||
import '../../profile/domain/notifiers/profile_notifier.dart';
|
||||
import 'dart:html' as html;
|
||||
import '../../../core/services/web_window.dart';
|
||||
|
||||
class LoginScreen extends ConsumerStatefulWidget {
|
||||
final String? verificationToken;
|
||||
@@ -109,10 +109,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
return;
|
||||
}
|
||||
final pendingProvider = AuthTokenStore.getPendingProvider();
|
||||
final provider = pendingProvider ?? AuthTokenStore.getProvider();
|
||||
if (provider == null || !provider.toLowerCase().contains('ory')) {
|
||||
return;
|
||||
}
|
||||
final provider = pendingProvider ?? AuthTokenStore.getProvider() ?? 'ory';
|
||||
|
||||
try {
|
||||
await AuthProxyService.checkCookieSession();
|
||||
@@ -657,7 +654,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
if (mounted) Navigator.of(context).pop();
|
||||
|
||||
if (redirectTo != null && redirectTo.isNotEmpty) {
|
||||
html.window.location.href = redirectTo;
|
||||
webWindow.redirectTo(redirectTo);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -885,6 +882,24 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
debugPrint("[Auth] Failed to pre-fetch profile: $e");
|
||||
}
|
||||
|
||||
if (_loginChallenge != null && _loginChallenge!.isNotEmpty) {
|
||||
try {
|
||||
final res = await AuthProxyService.acceptOidcLogin(
|
||||
_loginChallenge!,
|
||||
token: token,
|
||||
);
|
||||
final redirectTo = res['redirectTo'] as String?;
|
||||
if (redirectTo != null && redirectTo.isNotEmpty) {
|
||||
debugPrint("[Auth] OIDC login accepted. Redirecting to: $redirectTo");
|
||||
webWindow.redirectTo(redirectTo);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
_showError("OIDC 로그인 처리에 실패했습니다. 다시 시도해 주세요.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (WebAuthIntegration.isPopup()) {
|
||||
debugPrint("[Auth] Popup detected. Notifying opener and attempting to close.");
|
||||
WebAuthIntegration.sendLoginSuccess(token);
|
||||
|
||||
Reference in New Issue
Block a user