Add Baron Safe app features through session block skeleton
ci / flutter-check (push) Successful in 4s

This commit is contained in:
2026-06-30 17:17:14 +09:00
parent d2f6af7657
commit 7c8e95e0a3
23 changed files with 1531 additions and 5 deletions
@@ -0,0 +1,36 @@
class BaronSafeWebViewPolicy {
const BaronSafeWebViewPolicy({this.allowedHosts = defaultAllowedHosts});
static const defaultAllowedHosts = {
'safe.baron.hmac.kr',
'safe-staging.baron.hmac.kr',
'localhost',
'127.0.0.1',
'10.0.2.2',
};
final Set<String> allowedHosts;
bool allows(Uri uri) {
if (!uri.hasScheme || !uri.hasAuthority) {
return false;
}
if (uri.scheme != 'https' && uri.scheme != 'http') {
return false;
}
if (uri.scheme == 'http' && !_isLocalHost(uri.host)) {
return false;
}
return allowedHosts.contains(uri.host.toLowerCase());
}
bool _isLocalHost(String host) {
final normalizedHost = host.toLowerCase();
return normalizedHost == 'localhost' ||
normalizedHost == '127.0.0.1' ||
normalizedHost == '10.0.2.2';
}
}