Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/config/oidc_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class OidcSettings {
/// Deep-link scheme the provider redirects back to (e.g. `schulytest`),
/// derived from [redirectUri] so the app never hardcodes it.
String get callbackScheme => Uri.parse(redirectUri).scheme;

/// Whether the OIDC endpoints use plaintext `http://` (a self-hosted / local
/// backend). flutter_appauth rejects http unless told to allow it, so this
/// gates `allowInsecureConnections`; https providers stay strict.
bool get allowInsecureConnections => Uri.parse(authorizationEndpoint).scheme == 'http' || Uri.parse(tokenEndpoint).scheme == 'http';
}

class OidcConfig {
Expand Down
3 changes: 3 additions & 0 deletions lib/services/auth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class AuthService {
serviceConfiguration: _serviceConfig(cfg),
scopes: cfg.scopes,
promptValues: register ? const ['create'] : null,
allowInsecureConnections: cfg.allowInsecureConnections,
),
);
return _persist(result);
Expand Down Expand Up @@ -146,6 +147,7 @@ class AuthService {
serviceConfiguration: _serviceConfig(cfg),
refreshToken: refreshToken,
scopes: cfg.scopes,
allowInsecureConnections: cfg.allowInsecureConnections,
),
);
final tokens = await _persist(result);
Expand Down Expand Up @@ -187,6 +189,7 @@ class AuthService {
idTokenHint: idToken,
postLogoutRedirectUrl: cfg.redirectUri,
serviceConfiguration: _serviceConfig(cfg),
allowInsecureConnections: cfg.allowInsecureConnections,
),
);
}
Expand Down
Loading