mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Use identity server from well-known when creating the client
This commit is contained in:
+13
-3
@@ -186,14 +186,24 @@ class AuthenticationService: NSObject {
|
||||
MXLog.error("[AuthenticationService] Unable to create a URL from the supplied homeserver address when calling loginFlow.")
|
||||
throw AuthenticationError.invalidHomeserver
|
||||
}
|
||||
|
||||
var identityServerURL: URL?
|
||||
|
||||
if let wellKnown = try? await wellKnown(for: homeserverURL),
|
||||
let baseURL = URL(string: wellKnown.homeServer.baseUrl) {
|
||||
homeserverURL = baseURL
|
||||
if let wellKnown = try? await wellKnown(for: homeserverURL) {
|
||||
if let baseURL = URL(string: wellKnown.homeServer.baseUrl) {
|
||||
homeserverURL = baseURL
|
||||
}
|
||||
if let identityServer = wellKnown.identityServer,
|
||||
let baseURL = URL(string: identityServer.baseUrl) {
|
||||
identityServerURL = baseURL
|
||||
}
|
||||
}
|
||||
|
||||
#warning("Add an unrecognized certificate handler.")
|
||||
let client = MXRestClient(homeServer: homeserverURL, unrecognizedCertificateHandler: nil)
|
||||
if let identityServerURL = identityServerURL {
|
||||
client.identityServer = identityServerURL.absoluteString
|
||||
}
|
||||
|
||||
let loginFlow = try await getLoginFlowResult(client: client)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user