feat: Make FluffyChat OIDC aware client

This commit is contained in:
Krille 2024-10-23 16:51:05 +02:00
parent 282f45059c
commit 04aedb0ef6
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652

View file

@ -134,7 +134,16 @@ class HomeserverPickerController extends State<HomeserverPicker> {
bool isDefaultPlatform = bool isDefaultPlatform =
(PlatformInfos.isMobile || PlatformInfos.isWeb || PlatformInfos.isMacOS); (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 { void ssoLoginAction() async {
final redirectUrl = kIsWeb final redirectUrl = kIsWeb
@ -241,3 +250,11 @@ class IdentityProvider {
brand: json['brand'], brand: json['brand'],
); );
} }
extension on LoginFlow {
bool get delegateOidcCompatibility =>
additionalProperties.tryGet<bool>('delegated_oidc_compatibility') ??
additionalProperties
.tryGet<bool>('org.matrix.msc3824.delegated_oidc_compatibility') ??
false;
}