forked from baron/baron-sso
린트 적용
This commit is contained in:
@@ -46,7 +46,9 @@ void main() async {
|
||||
FlutterError.presentError(details);
|
||||
_log.severe("FLUTTER_ERROR", details.exception, details.stack);
|
||||
// Also send to backend if needed
|
||||
AuthProxyService.logError("FLUTTER_ERROR: ${details.exception}\n${details.stack}");
|
||||
AuthProxyService.logError(
|
||||
"FLUTTER_ERROR: ${details.exception}\n${details.stack}",
|
||||
);
|
||||
};
|
||||
|
||||
PlatformDispatcher.instance.onError = (error, stack) {
|
||||
@@ -86,18 +88,19 @@ final _router = GoRouter(
|
||||
return const DashboardScreen();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/profile',
|
||||
builder: (context, state) => const ProfilePage(),
|
||||
),
|
||||
GoRoute(path: '/profile', builder: (context, state) => const ProfilePage()),
|
||||
GoRoute(
|
||||
path: '/signin',
|
||||
builder: (context, state) {
|
||||
final loginChallenge = state.uri.queryParameters['login_challenge'];
|
||||
final redirectUrl = state.uri.queryParameters['redirect_uri'] ?? state.uri.queryParameters['redirect_url'];
|
||||
_routerLogger.info("Navigating to /signin with login_challenge: $loginChallenge, redirect: $redirectUrl");
|
||||
final redirectUrl =
|
||||
state.uri.queryParameters['redirect_uri'] ??
|
||||
state.uri.queryParameters['redirect_url'];
|
||||
_routerLogger.info(
|
||||
"Navigating to /signin with login_challenge: $loginChallenge, redirect: $redirectUrl",
|
||||
);
|
||||
return LoginScreen(
|
||||
key: state.pageKey,
|
||||
key: state.pageKey,
|
||||
loginChallenge: loginChallenge,
|
||||
redirectUrl: redirectUrl,
|
||||
);
|
||||
@@ -106,12 +109,11 @@ final _router = GoRouter(
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
builder: (context, state) {
|
||||
final redirectUrl = state.uri.queryParameters['redirect_uri'] ?? state.uri.queryParameters['redirect_url'];
|
||||
final redirectUrl =
|
||||
state.uri.queryParameters['redirect_uri'] ??
|
||||
state.uri.queryParameters['redirect_url'];
|
||||
_routerLogger.info("Navigating to /login, redirect: $redirectUrl");
|
||||
return LoginScreen(
|
||||
key: state.pageKey,
|
||||
redirectUrl: redirectUrl,
|
||||
);
|
||||
return LoginScreen(key: state.pageKey, redirectUrl: redirectUrl);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
@@ -120,7 +122,9 @@ final _router = GoRouter(
|
||||
final consentChallenge = state.uri.queryParameters['consent_challenge'];
|
||||
if (consentChallenge == null) {
|
||||
_routerLogger.warning("Consent screen loaded without a challenge.");
|
||||
return const Scaffold(body: Center(child: Text('Error: Consent challenge is missing.')));
|
||||
return const Scaffold(
|
||||
body: Center(child: Text('Error: Consent challenge is missing.')),
|
||||
);
|
||||
}
|
||||
_routerLogger.info("Navigating to /consent with challenge.");
|
||||
return ConsentScreen(consentChallenge: consentChallenge);
|
||||
@@ -257,21 +261,22 @@ final _router = GoRouter(
|
||||
final path = state.uri.path;
|
||||
|
||||
// Public paths that don't require login
|
||||
final isPublicPath = path == '/signin' ||
|
||||
path == '/signup' ||
|
||||
path == '/login' ||
|
||||
path == '/registration' ||
|
||||
path == '/verify' ||
|
||||
path == '/verification' ||
|
||||
path.startsWith('/verify/') ||
|
||||
path == '/approve' ||
|
||||
path.startsWith('/ql/') ||
|
||||
path == '/forgot-password' ||
|
||||
path == '/recovery' ||
|
||||
path == '/reset-password' ||
|
||||
path == '/error' ||
|
||||
path == '/settings' ||
|
||||
path == '/consent'; // Consent page is public
|
||||
final isPublicPath =
|
||||
path == '/signin' ||
|
||||
path == '/signup' ||
|
||||
path == '/login' ||
|
||||
path == '/registration' ||
|
||||
path == '/verify' ||
|
||||
path == '/verification' ||
|
||||
path.startsWith('/verify/') ||
|
||||
path == '/approve' ||
|
||||
path.startsWith('/ql/') ||
|
||||
path == '/forgot-password' ||
|
||||
path == '/recovery' ||
|
||||
path == '/reset-password' ||
|
||||
path == '/error' ||
|
||||
path == '/settings' ||
|
||||
path == '/consent'; // Consent page is public
|
||||
|
||||
_routerLogger.fine("Redirect check - Path: $path, IsLoggedIn: $isLoggedIn");
|
||||
|
||||
@@ -282,7 +287,7 @@ final _router = GoRouter(
|
||||
|
||||
// If not logged in and trying to access a protected page, redirect to /signin
|
||||
if (!isLoggedIn) {
|
||||
_routerLogger.info("Not logged in, redirecting to /signin");
|
||||
_routerLogger.info("Not logged in, redirecting to /signin");
|
||||
// Preserve OIDC challenge if present
|
||||
final loginChallenge = state.uri.queryParameters['login_challenge'];
|
||||
if (loginChallenge != null) {
|
||||
|
||||
Reference in New Issue
Block a user