Use UTF_8 for basic authorization

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-10-26 13:25:33 +02:00
parent 3db8baabe4
commit e5788016cf
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 9 additions and 4 deletions

View File

@ -40,6 +40,7 @@ import java.io.IOException;
import java.net.CookieManager; import java.net.CookieManager;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Proxy; import java.net.Proxy;
import java.nio.charset.StandardCharsets;
import java.security.KeyStore; import java.security.KeyStore;
import java.security.KeyStoreException; import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -209,9 +210,12 @@ public class RestModule {
if (appPreferences.getProxyCredentials() && if (appPreferences.getProxyCredentials() &&
!TextUtils.isEmpty(appPreferences.getProxyUsername()) && !TextUtils.isEmpty(appPreferences.getProxyUsername()) &&
!TextUtils.isEmpty(appPreferences.getProxyPassword())) { !TextUtils.isEmpty(appPreferences.getProxyPassword())) {
httpClient.proxyAuthenticator(new HttpAuthenticator(Credentials.basic( httpClient.proxyAuthenticator(new HttpAuthenticator(
Credentials.basic(
appPreferences.getProxyUsername(), appPreferences.getProxyUsername(),
appPreferences.getProxyPassword()), "Proxy-Authorization")); appPreferences.getProxyPassword(),
StandardCharsets.UTF_8),
"Proxy-Authorization"));
} }
} }

View File

@ -34,6 +34,7 @@ import com.nextcloud.talk.data.user.model.User;
import com.nextcloud.talk.models.RetrofitBucket; import com.nextcloud.talk.models.RetrofitBucket;
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew; import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew;
import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -399,7 +400,7 @@ public class ApiUtils {
if (TextUtils.isEmpty(username) && TextUtils.isEmpty(token)) { if (TextUtils.isEmpty(username) && TextUtils.isEmpty(token)) {
return null; return null;
} }
return Credentials.basic(username, token); return Credentials.basic(username, token, StandardCharsets.UTF_8);
} }
public static String getUrlNextcloudPush(String baseUrl) { public static String getUrlNextcloudPush(String baseUrl) {