Added a setting to choose if we want to use the SIP address username as SSO username

This commit is contained in:
Sylvain Berfini 2024-08-07 14:17:05 +02:00
parent 505fa3b66c
commit 247788c64c
2 changed files with 7 additions and 1 deletions

View file

@ -216,6 +216,10 @@ class CorePreferences @UiThread constructor(private val context: Context) {
val hideAssistantThirdPartySipAccount: Boolean
get() = config.getBool("ui", "assistant_hide_third_party_account", false)
@get:WorkerThread
val useUsernameAsSingleSignOnLoginHint: Boolean
get() = config.getBool("ui", "use_username_as_sso_login_hint", true)
/* Paths */
@get:WorkerThread

View file

@ -35,6 +35,7 @@ import net.openid.appauth.AuthorizationServiceConfiguration
import net.openid.appauth.ResponseTypeValues
import org.json.JSONObject
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.core.Factory
import org.linphone.core.tools.Log
import org.linphone.ui.GenericViewModel
@ -136,7 +137,8 @@ class SingleSignOnViewModel : GenericViewModel() {
// an invalid grant error with description "Session not active"
authRequestBuilder.setScopes("offline_access")
if (username.isNotEmpty()) {
if (username.isNotEmpty() && corePreferences.useUsernameAsSingleSignOnLoginHint) {
Log.i("$TAG Using username [$username] as login hint")
authRequestBuilder.setLoginHint(username)
}