Unterschriftenerfassung dauerhaft auf Deutsch anzeigen, lokale VHS-Buildkonfiguration und Regressionstests ergänzen sowie Version auf 357.0.0+357 anheben.
34 lines
924 B
Dart
34 lines
924 B
Dart
class VhsMapAccess {
|
|
VhsMapAccess(this.uri);
|
|
|
|
final Uri uri;
|
|
static const int maxAuthenticationAttempts = 3;
|
|
int _authenticationAttempts = 0;
|
|
|
|
static bool _isValidUri(Uri value) =>
|
|
value.scheme == 'https' &&
|
|
value.hasAuthority &&
|
|
value.host.isNotEmpty &&
|
|
value.userInfo.isEmpty &&
|
|
value.port > 0 &&
|
|
value.port <= 65535;
|
|
|
|
bool get isValid => _isValidUri(uri);
|
|
|
|
bool allowsNavigation(Uri target) =>
|
|
isValid && _isValidUri(target) && target.origin == uri.origin;
|
|
|
|
// Die WebView liefert bei Authentifizierungsanfragen nur Host und Realm.
|
|
bool allowsAuthentication(String host) =>
|
|
isValid && host.toLowerCase() == uri.host.toLowerCase();
|
|
|
|
bool tryAuthentication(String host) {
|
|
if (!allowsAuthentication(host) ||
|
|
_authenticationAttempts >= maxAuthenticationAttempts) {
|
|
return false;
|
|
}
|
|
_authenticationAttempts++;
|
|
return true;
|
|
}
|
|
}
|