forked from baron/baron-sso
OIDC로 빠지는 분기 점검 login_challenge 복구 fallback 추가
This commit is contained in:
@@ -3,6 +3,14 @@ class WebWindow {
|
||||
|
||||
void redirectTo(String url) {}
|
||||
|
||||
String currentHref() {
|
||||
return '';
|
||||
}
|
||||
|
||||
String currentSearch() {
|
||||
return '';
|
||||
}
|
||||
|
||||
void alert(String message) {}
|
||||
|
||||
void close() {}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// ignore_for_file: avoid_web_libraries_in_flutter, deprecated_member_use
|
||||
|
||||
import 'dart:html' as html;
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class WebWindow {
|
||||
void setTitle(String title) {
|
||||
@@ -8,7 +9,48 @@ class WebWindow {
|
||||
}
|
||||
|
||||
void redirectTo(String url) {
|
||||
final currentHref = html.window.location.href;
|
||||
Uri? targetUri;
|
||||
try {
|
||||
targetUri = Uri.parse(url);
|
||||
} catch (_) {
|
||||
debugPrint("[WebWindow] redirectTo parse failed: url=$url");
|
||||
}
|
||||
|
||||
final currentPort = int.tryParse(html.window.location.port);
|
||||
final sameOrigin =
|
||||
targetUri != null &&
|
||||
targetUri.scheme == html.window.location.protocol.replaceAll(':', '') &&
|
||||
targetUri.host == html.window.location.hostname &&
|
||||
(!targetUri.hasPort || targetUri.port == currentPort);
|
||||
|
||||
debugPrint(
|
||||
"[WebWindow] redirectTo start: current=$currentHref, target=$url, target_host=${targetUri?.host ?? ''}, target_path=${targetUri?.path ?? ''}, same_origin=$sameOrigin",
|
||||
);
|
||||
|
||||
html.window.location.href = url;
|
||||
|
||||
// 이동이 차단되거나 즉시 원위치되는 경우를 추적하기 위한 후속 로그입니다.
|
||||
Future<void>.delayed(const Duration(milliseconds: 800), () {
|
||||
final nowHref = html.window.location.href;
|
||||
if (nowHref == currentHref) {
|
||||
debugPrint(
|
||||
"[WebWindow] redirectTo no-op detected: current URL did not change after navigation attempt",
|
||||
);
|
||||
} else {
|
||||
debugPrint(
|
||||
"[WebWindow] redirectTo post-check: location changed to $nowHref",
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String currentHref() {
|
||||
return html.window.location.href;
|
||||
}
|
||||
|
||||
String currentSearch() {
|
||||
return html.window.location.search ?? '';
|
||||
}
|
||||
|
||||
void alert(String message) {
|
||||
|
||||
Reference in New Issue
Block a user