fix: move decrypt() for accessToken
This commit is contained in:
parent
091f7eeacf
commit
b6cebf16fb
@ -8,6 +8,7 @@ import com.pcloud.sdk.PCloudSdk;
|
||||
|
||||
import org.cryptomator.data.cloud.okhttplogging.HttpLoggingInterceptor;
|
||||
import org.cryptomator.util.SharedPreferencesHandler;
|
||||
import org.cryptomator.util.crypto.CredentialCryptor;
|
||||
import org.cryptomator.util.file.LruFileCacheUtil;
|
||||
|
||||
import okhttp3.Cache;
|
||||
@ -49,6 +50,12 @@ class PCloudClientFactory {
|
||||
|
||||
OkHttpClient okHttpClient = okHttpClientBuilder.build();
|
||||
|
||||
return PCloudSdk.newClientBuilder().authenticator(Authenticators.newOAuthAuthenticator(accessToken)).withClient(okHttpClient).apiHost(url).create();
|
||||
return PCloudSdk.newClientBuilder().authenticator(Authenticators.newOAuthAuthenticator(decrypt(accessToken, context))).withClient(okHttpClient).apiHost(url).create();
|
||||
}
|
||||
|
||||
private String decrypt(String password, Context context) {
|
||||
return CredentialCryptor //
|
||||
.getInstance(context) //
|
||||
.decrypt(password);
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,7 @@ class PCloudImpl {
|
||||
}
|
||||
|
||||
private ApiClient client() {
|
||||
return clientFactory.getClient(decrypt(cloud.accessToken()), cloud.url(), context);
|
||||
}
|
||||
|
||||
private String decrypt(String password) {
|
||||
return CredentialCryptor //
|
||||
.getInstance(context) //
|
||||
.decrypt(password);
|
||||
return clientFactory.getClient(cloud.accessToken(), cloud.url(), context);
|
||||
}
|
||||
|
||||
public PCloudFolder root() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user