@@ -19,6 +19,23 @@ class AuthConfig {
1919 defaultValue: 'https://secrandom-online.sectl.top/auth_callback' ,
2020 );
2121
22+ static const String authCallbackWebUrl = String .fromEnvironment (
23+ 'SECTL_AUTH_CALLBACK_WEB_URL' ,
24+ defaultValue: 'https://secrandom-online.sectl.top/auth_callback_web.html' ,
25+ );
26+
27+ static const String authCallbackAndroidUrl = String .fromEnvironment (
28+ 'SECTL_AUTH_CALLBACK_ANDROID_URL' ,
29+ defaultValue:
30+ 'https://secrandom-online.sectl.top/auth_callback_android.html' ,
31+ );
32+
33+ static const String authCallbackWindowsUrl = String .fromEnvironment (
34+ 'SECTL_AUTH_CALLBACK_WINDOWS_URL' ,
35+ defaultValue:
36+ 'https://secrandom-online.sectl.top/auth_callback_windows.html' ,
37+ );
38+
2239 static const String webAppUrl = String .fromEnvironment (
2340 'SECTL_WEB_APP_URL' ,
2441 defaultValue: 'https://secrandom-online.sectl.top/' ,
@@ -35,15 +52,30 @@ class AuthConfig {
3552 static const String refreshEndpoint = '/api/oauth/refresh' ;
3653 static const String userInfoEndpoint = '/api/oauth/userinfo' ;
3754 static const String logoutEndpoint = '/api/oauth/logout' ;
55+ static const String publicIpLookupUrl = String .fromEnvironment (
56+ 'SECTL_PUBLIC_IP_URL' ,
57+ defaultValue: 'https://api64.ipify.org?format=json' ,
58+ );
3859
3960 static const String callbackScheme = 'secrandom' ;
4061 static const String callbackHost = 'auth' ;
4162 static const String callbackPath = '/callback' ;
4263
4364 static const String loopbackHost = '127.0.0.1' ;
44- static const int loopbackPort = 8788 ;
65+ static const int windowsLoopbackPort = int .fromEnvironment (
66+ 'SECTL_WINDOWS_LOOPBACK_PORT' ,
67+ defaultValue: 8788 ,
68+ );
69+ static const int androidLoopbackPort = int .fromEnvironment (
70+ 'SECTL_ANDROID_LOOPBACK_PORT' ,
71+ defaultValue: 8789 ,
72+ );
4573 static const String loopbackPath = '/callback' ;
4674
75+ static const int webAuthCookieMaxAgeDays = 30 ;
76+ static const String webCookieAuthSignalKey = 'oauth_cookie' ;
77+ static const String webCookieAuthSignalValue = '1' ;
78+
4779 static const String accessTokenKey = 'sectl_access_token' ;
4880 static const String refreshTokenKey = 'sectl_refresh_token' ;
4981 static const String tokenExpiresAtKey = 'sectl_token_expires_at' ;
@@ -60,6 +92,33 @@ class AuthConfig {
6092 return authCallbackBridgeUrl;
6193 }
6294
95+ static String get webOauthRedirectUri {
96+ if (useMockAuth &&
97+ authCallbackWebUrl ==
98+ 'https://secrandom-online.sectl.top/auth_callback_web.html' ) {
99+ return '$mockAuthBaseUrl /auth_callback_web.html' ;
100+ }
101+ return authCallbackWebUrl;
102+ }
103+
104+ static String get androidOauthRedirectUri {
105+ if (useMockAuth &&
106+ authCallbackAndroidUrl ==
107+ 'https://secrandom-online.sectl.top/auth_callback_android.html' ) {
108+ return '$mockAuthBaseUrl /auth_callback_android.html' ;
109+ }
110+ return authCallbackAndroidUrl;
111+ }
112+
113+ static String get windowsOauthRedirectUri {
114+ if (useMockAuth &&
115+ authCallbackWindowsUrl ==
116+ 'https://secrandom-online.sectl.top/auth_callback_windows.html' ) {
117+ return '$mockAuthBaseUrl /auth_callback_windows.html' ;
118+ }
119+ return authCallbackWindowsUrl;
120+ }
121+
63122 static String get deepLinkCallbackUri =>
64123 '$callbackScheme ://$callbackHost $callbackPath ' ;
65124
0 commit comments