Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 137b417

Browse files
authored
Merge pull request #331 from owncloud/fix/refresh_basic_credentials
[Fix] Refresh credentials
2 parents cdd1604 + 23a38a7 commit 137b417

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/SingleSessionManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import android.net.Uri;
3333

3434
import com.owncloud.android.lib.common.accounts.AccountUtils;
35+
import com.owncloud.android.lib.common.authentication.OwnCloudCredentials;
3536
import com.owncloud.android.lib.common.http.HttpClient;
3637
import timber.log.Timber;
3738

@@ -191,6 +192,15 @@ private void keepCookiesUpdated(Context context, OwnCloudAccount account, OwnClo
191192
}
192193
}
193194

195+
public void refreshCredentialsForAccount(String accountName, OwnCloudCredentials credentials) {
196+
OwnCloudClient ownCloudClient = mClientsWithKnownUsername.get(accountName);
197+
if (ownCloudClient == null) {
198+
return;
199+
}
200+
ownCloudClient.setCredentials(credentials);
201+
mClientsWithKnownUsername.replace(accountName, ownCloudClient);
202+
}
203+
194204
// this method is just a patch; we need to distinguish accounts in the same host but
195205
// different paths; but that requires updating the accountNames for apps upgrading
196206
private void keepUriUpdated(OwnCloudAccount account, OwnCloudClient reusedClient) {

0 commit comments

Comments
 (0)