From 50cb162bd3c60d96fce1cc0ddb7e783b353e1ecf Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 22 Oct 2024 16:40:57 +0200 Subject: [PATCH] Fixed SSO sign-in when using remote provisioning without credentials information available --- .../java/org/linphone/core/CoreContext.kt | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/linphone/core/CoreContext.kt b/app/src/main/java/org/linphone/core/CoreContext.kt index 4b1947564..a8fa2b3eb 100644 --- a/app/src/main/java/org/linphone/core/CoreContext.kt +++ b/app/src/main/java/org/linphone/core/CoreContext.kt @@ -275,15 +275,15 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C @WorkerThread override fun onAuthenticationRequested(core: Core, authInfo: AuthInfo, method: AuthMethod) { - if (authInfo.username == null || authInfo.domain == null || authInfo.realm == null) { - Log.e( - "$TAG Authentication request but either username [${authInfo.username}], domain [${authInfo.domain}] or realm [${authInfo.realm}] is null!" - ) - return - } - when (method) { AuthMethod.Bearer -> { + if (authInfo.authorizationServer == null) { + Log.e( + "$TAG Authentication request using Bearer method but authorization server is null!" + ) + return + } + val serverUrl = authInfo.authorizationServer val username = authInfo.username if (!serverUrl.isNullOrEmpty()) { @@ -301,6 +301,13 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C } } AuthMethod.HttpDigest -> { + if (authInfo.username == null || authInfo.domain == null || authInfo.realm == null) { + Log.e( + "$TAG Authentication request using Digest method but either username [${authInfo.username}], domain [${authInfo.domain}] or realm [${authInfo.realm}] is null!" + ) + return + } + val accountFound = core.accountList.find { it.params.identityAddress?.username == authInfo.username && it.params.identityAddress?.domain == authInfo.domain }