mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +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)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ class SessionCreator {
|
||||
func createSession(credentials: MXCredentials, client: AuthenticationRestClient) -> MXSession {
|
||||
// Report the new account in account manager
|
||||
if credentials.identityServer == nil {
|
||||
#warning("Check that the client is actually updated with this info?")
|
||||
credentials.identityServer = client.identityServer
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user