feat: (BREAKING) Discover OIDC auth metadata on Client.checkHomeserver()

This commit is contained in:
Christian Kußowski 2025-11-04 13:19:36 +01:00
parent 3106b5d877
commit 374c8c5379
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 15 additions and 1 deletions

View File

@ -515,6 +515,7 @@ class Client extends MatrixApi {
DiscoveryInformation?,
GetVersionsResponse versions,
List<LoginFlow>,
GetAuthMetadataResponse? authMetadata,
)> checkHomeserver(
Uri homeserverUrl, {
bool checkWellKnown = true,
@ -554,7 +555,20 @@ class Client extends MatrixApi {
);
}
return (wellKnown, versions, loginTypes);
GetAuthMetadataResponse? authMetadata;
if (versions.versions.any(
(v) => isVersionGreaterThanOrEqualTo(v, 'v1.16'),
)) {
try {
authMetadata = await getAuthMetadata();
} on MatrixException catch (e, s) {
if (e.error != MatrixError.M_UNRECOGNIZED) {
Logs().w('Unable to discover OIDC auth metadata.', e, s);
}
}
}
return (wellKnown, versions, loginTypes, authMetadata);
} catch (_) {
homeserver = null;
rethrow;