From 04aedb0ef62ffa83620d7e37b929092e6cfc6d3f Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 23 Oct 2024 16:51:05 +0200 Subject: [PATCH] feat: Make FluffyChat OIDC aware client --- .../homeserver_picker/homeserver_picker.dart | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/pages/homeserver_picker/homeserver_picker.dart b/lib/pages/homeserver_picker/homeserver_picker.dart index 81b33aa00..af486aee5 100644 --- a/lib/pages/homeserver_picker/homeserver_picker.dart +++ b/lib/pages/homeserver_picker/homeserver_picker.dart @@ -134,7 +134,16 @@ class HomeserverPickerController extends State { bool isDefaultPlatform = (PlatformInfos.isMobile || PlatformInfos.isWeb || PlatformInfos.isMacOS); - bool get supportsPasswordLogin => _supportsFlow('m.login.password'); + bool get supportsPasswordLogin => + _supportsFlow('m.login.password') && + // OIDC Aware client we should hide password login if + // "delegated_oidc_compatibility" is `true`. + // https://github.com/matrix-org/matrix-spec-proposals/blob/hughns/sso-redirect-action/proposals/3824-oidc-aware-clients.md + loginFlows?.any( + (flow) => + flow.type == 'm.login.sso' && flow.delegateOidcCompatibility, + ) == + false; void ssoLoginAction() async { final redirectUrl = kIsWeb @@ -241,3 +250,11 @@ class IdentityProvider { brand: json['brand'], ); } + +extension on LoginFlow { + bool get delegateOidcCompatibility => + additionalProperties.tryGet('delegated_oidc_compatibility') ?? + additionalProperties + .tryGet('org.matrix.msc3824.delegated_oidc_compatibility') ?? + false; +}