updating the well known lookup to take into account certificate errors when triggered via the sign in with matrix id flow
This commit is contained in:
parent
3c9b5d2ec0
commit
e97cdb03fa
|
@ -0,0 +1 @@
|
||||||
|
Including SSL/TLS error handing when doing WellKnown lookups without a custom HomeServerConnectionConfig
|
|
@ -382,11 +382,16 @@ internal class DefaultAuthenticationService @Inject constructor(
|
||||||
return getWellknownTask.execute(
|
return getWellknownTask.execute(
|
||||||
GetWellknownTask.Params(
|
GetWellknownTask.Params(
|
||||||
domain = matrixId.getDomain(),
|
domain = matrixId.getDomain(),
|
||||||
homeServerConnectionConfig = homeServerConnectionConfig
|
homeServerConnectionConfig = homeServerConnectionConfig.orWellKnownDefaults()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun HomeServerConnectionConfig?.orWellKnownDefaults() = this ?: HomeServerConnectionConfig.Builder()
|
||||||
|
// server uri is ignored when doing a wellknown lookup as we use the matrix id domain instead
|
||||||
|
.withHomeServerUri("https://dummy.org")
|
||||||
|
.build()
|
||||||
|
|
||||||
override suspend fun directAuthentication(homeServerConnectionConfig: HomeServerConnectionConfig,
|
override suspend fun directAuthentication(homeServerConnectionConfig: HomeServerConnectionConfig,
|
||||||
matrixId: String,
|
matrixId: String,
|
||||||
password: String,
|
password: String,
|
||||||
|
|
|
@ -43,7 +43,7 @@ internal interface GetWellknownTask : Task<GetWellknownTask.Params, WellknownRes
|
||||||
* the URL will be https://{domain}/.well-known/matrix/client
|
* the URL will be https://{domain}/.well-known/matrix/client
|
||||||
*/
|
*/
|
||||||
val domain: String,
|
val domain: String,
|
||||||
val homeServerConnectionConfig: HomeServerConnectionConfig?
|
val homeServerConnectionConfig: HomeServerConnectionConfig
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,15 +61,11 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
||||||
return findClientConfig(params.domain, client)
|
return findClientConfig(params.domain, client)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildClient(homeServerConnectionConfig: HomeServerConnectionConfig?): OkHttpClient {
|
private fun buildClient(homeServerConnectionConfig: HomeServerConnectionConfig): OkHttpClient {
|
||||||
return if (homeServerConnectionConfig != null) {
|
return okHttpClient.get()
|
||||||
okHttpClient.get()
|
.newBuilder()
|
||||||
.newBuilder()
|
.addSocketFactory(homeServerConnectionConfig)
|
||||||
.addSocketFactory(homeServerConnectionConfig)
|
.build()
|
||||||
.build()
|
|
||||||
} else {
|
|
||||||
okHttpClient.get()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue