Skip to content

Commit

Permalink
fix: remove legacy pre-sdk19 credentials basic function
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
  • Loading branch information
AndyScherzinger committed Nov 14, 2024
1 parent 5641357 commit 03355fb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 37 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

import android.os.Parcel;

import com.nextcloud.common.OkHttpCredentialsUtil;
import java.nio.charset.StandardCharsets;

import okhttp3.Credentials;

public class OwnCloudAnonymousCredentials implements OwnCloudCredentials {

Expand All @@ -35,7 +37,7 @@ public boolean authTokenExpires() {

@Override
public String toOkHttpCredentials() {
return OkHttpCredentialsUtil.basic(getUsername(), getAuthToken());
return Credentials.basic(getUsername(), getAuthToken(), StandardCharsets.UTF_8);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

import android.os.Parcel;

import com.nextcloud.common.OkHttpCredentialsUtil;

import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthPolicy;
import org.apache.commons.httpclient.auth.AuthScope;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

import okhttp3.Credentials;

public class OwnCloudBasicCredentials implements OwnCloudCredentials {

private String username;
Expand Down Expand Up @@ -59,11 +60,9 @@ public boolean authTokenExpires() {

@Override
public String toOkHttpCredentials() {
return OkHttpCredentialsUtil.basic(username, authToken);
return Credentials.basic(username, authToken, StandardCharsets.UTF_8);
}



/*
* Autogenerated Parcelable interface
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.os.Bundle;

import com.nextcloud.common.NextcloudClient;
import com.nextcloud.common.OkHttpCredentialsUtil;
import com.nextcloud.common.User;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils;
Expand All @@ -32,8 +31,11 @@
import com.owncloud.android.lib.common.utils.Log_OC;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;

import okhttp3.Credentials;

public class OwnCloudClientFactory {

final private static String TAG = OwnCloudClientFactory.class.getSimpleName();
Expand Down Expand Up @@ -223,7 +225,7 @@ public static NextcloudClient createNextcloudClient(Account account, Context app

return createNextcloudClient(baseUri,
userId,
OkHttpCredentialsUtil.basic(username, password),
Credentials.basic(username, password, StandardCharsets.UTF_8),
appContext,
true);
}
Expand Down

0 comments on commit 03355fb

Please sign in to comment.