This commit is contained in:
Benoit Marty 2020-04-27 00:12:11 +02:00
parent a70fdedce5
commit cf7de8bb8b
3 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ sealed class WellknownResult {
* Retrieve the specific piece of information from the user in a way which fits within the existing client user experience, * Retrieve the specific piece of information from the user in a way which fits within the existing client user experience,
* if the client is inclined to do so. Failure can take place instead if no good user experience for this is possible at this point. * if the client is inclined to do so. Failure can take place instead if no good user experience for this is possible at this point.
*/ */
data class Prompt(val homerServerUrl: String, data class Prompt(val homeServerUrl: String,
val identityServerUrl: String?, val identityServerUrl: String?,
val wellKnown: WellKnown) : WellknownResult() val wellKnown: WellKnown) : WellknownResult()

View File

@ -208,7 +208,7 @@ internal class DefaultAuthenticationService @Inject constructor(
return when (wellknownResult) { return when (wellknownResult) {
is WellknownResult.Prompt -> { is WellknownResult.Prompt -> {
val newHomeServerConnectionConfig = homeServerConnectionConfig.copy( val newHomeServerConnectionConfig = homeServerConnectionConfig.copy(
homeServerUri = Uri.parse(wellknownResult.homerServerUrl), homeServerUri = Uri.parse(wellknownResult.homeServerUrl),
identityServerUri = wellknownResult.identityServerUrl?.let { Uri.parse(it) } identityServerUri = wellknownResult.identityServerUrl?.let { Uri.parse(it) }
) )
@ -218,7 +218,7 @@ internal class DefaultAuthenticationService @Inject constructor(
apiCall = newAuthAPI.versions() apiCall = newAuthAPI.versions()
} }
getLoginFlowResult(newAuthAPI, versions, wellknownResult.homerServerUrl) getLoginFlowResult(newAuthAPI, versions, wellknownResult.homeServerUrl)
} }
else -> throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */) else -> throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
}.exhaustive }.exhaustive

View File

@ -485,7 +485,7 @@ class LoginViewModel @AssistedInject constructor(
private fun onWellknownSuccess(action: LoginAction.LoginOrRegister, wellKnownPrompt: WellknownResult.Prompt) { private fun onWellknownSuccess(action: LoginAction.LoginOrRegister, wellKnownPrompt: WellknownResult.Prompt) {
val homeServerConnectionConfig = HomeServerConnectionConfig( val homeServerConnectionConfig = HomeServerConnectionConfig(
homeServerUri = Uri.parse(wellKnownPrompt.homerServerUrl), homeServerUri = Uri.parse(wellKnownPrompt.homeServerUrl),
identityServerUri = wellKnownPrompt.identityServerUrl?.let { Uri.parse(it) } identityServerUri = wellKnownPrompt.identityServerUrl?.let { Uri.parse(it) }
) )