From 719190a7c345b60c17f38352edda1ce8de8c4a3c Mon Sep 17 00:00:00 2001 From: Juan Carlos Garrote Date: Mon, 22 Jan 2024 18:21:44 +0100 Subject: [PATCH] New brandable parameter to indicate whether sending or not `login_hint` and `user` parameters in login request URL --- .../android/presentation/authentication/LoginActivity.kt | 1 + .../android/presentation/authentication/oauth/OAuthUtils.kt | 5 +++-- owncloudApp/src/main/res/values/setup.xml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt index 00b1a84a0ee..7a5439c8413 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/LoginActivity.kt @@ -526,6 +526,7 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted codeChallenge = authenticationViewModel.codeChallenge, state = authenticationViewModel.oidcState, username = username, + sendLoginHintAndUser = resources.getBoolean(R.bool.send_login_hint_and_user), ) try { diff --git a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/oauth/OAuthUtils.kt b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/oauth/OAuthUtils.kt index e71ee4204f0..8036404e19b 100644 --- a/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/oauth/OAuthUtils.kt +++ b/owncloudApp/src/main/java/com/owncloud/android/presentation/authentication/oauth/OAuthUtils.kt @@ -105,7 +105,8 @@ class OAuthUtils { prompt: String, codeChallenge: String, state: String, - username: String? + username: String?, + sendLoginHintAndUser: Boolean, ): Uri = authorizationEndpoint.buildUpon().apply { appendQueryParameter(QUERY_PARAMETER_REDIRECT_URI, redirectUri) @@ -116,7 +117,7 @@ class OAuthUtils { appendQueryParameter(QUERY_PARAMETER_CODE_CHALLENGE, codeChallenge) appendQueryParameter(QUERY_PARAMETER_CODE_CHALLENGE_METHOD, CODE_CHALLENGE_METHOD) appendQueryParameter(QUERY_PARAMETER_STATE, state) - if (!username.isNullOrEmpty()) { + if (sendLoginHintAndUser && !username.isNullOrEmpty()) { appendQueryParameter(QUERY_PARAMETER_USER, username) appendQueryParameter(QUERY_PARAMETER_LOGIN_HINT, username) } diff --git a/owncloudApp/src/main/res/values/setup.xml b/owncloudApp/src/main/res/values/setup.xml index ab76806838e..ef34f6ab4b7 100644 --- a/owncloudApp/src/main/res/values/setup.xml +++ b/owncloudApp/src/main/res/values/setup.xml @@ -143,4 +143,6 @@ true + true +