forked from baron/baron-sso
fix: userfront 빌드 설정(--wasm 제거) 및 리다이렉션 로직 최종 반영 #243
This commit is contained in:
@@ -7,7 +7,7 @@ COPY . .
|
||||
# Get dependencies and build for web
|
||||
RUN flutter pub get
|
||||
RUN touch .env
|
||||
RUN flutter build web --release --no-tree-shake-icons --wasm
|
||||
RUN flutter build web --release --no-tree-shake-icons
|
||||
|
||||
# Stage 2: Serve with Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
@@ -11,8 +11,36 @@ void implSendLoginSuccess(String token) {
|
||||
effectiveToken = AuthTokenStore.getToken() ?? "";
|
||||
}
|
||||
|
||||
final fullUrl = html.window.location.href;
|
||||
final uri = Uri.base;
|
||||
final redirectUri = uri.queryParameters['redirect_uri'] ?? uri.queryParameters['redirect_url'];
|
||||
|
||||
// Try to find redirect_uri from standard parsing first, then manual string search
|
||||
String? redirectUri = uri.queryParameters['redirect_uri'] ?? uri.queryParameters['redirect_url'];
|
||||
|
||||
if (redirectUri == null) {
|
||||
// Manual fallback for cases where Uri.base misses params
|
||||
final searchParams = html.window.location.search;
|
||||
if (searchParams != null && searchParams.isNotEmpty) {
|
||||
final sUri = Uri.parse('?${searchParams.startsWith('?') ? searchParams.substring(1) : searchParams}');
|
||||
redirectUri = sUri.queryParameters['redirect_uri'] ?? sUri.queryParameters['redirect_url'];
|
||||
}
|
||||
}
|
||||
|
||||
// Final fallback: regex or manual search in fullUrl
|
||||
if (redirectUri == null) {
|
||||
for (final key in ['redirect_uri=', 'redirect_url=']) {
|
||||
if (fullUrl.contains(key)) {
|
||||
final start = fullUrl.indexOf(key) + key.length;
|
||||
var end = fullUrl.indexOf('&', start);
|
||||
if (end == -1) end = fullUrl.length;
|
||||
final raw = fullUrl.substring(start, end);
|
||||
try {
|
||||
redirectUri = Uri.decodeComponent(raw);
|
||||
break;
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (redirectUri != null && redirectUri.isNotEmpty) {
|
||||
// Redirection flow
|
||||
|
||||
Reference in New Issue
Block a user