Loading src/com/owncloud/android/lib/common/DynamicSessionManager.java +13 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.accounts.OperationCanceledException; import android.content.Context; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.resources.status.OwnCloudVersion; import java.io.IOException; Loading @@ -28,7 +29,18 @@ public class DynamicSessionManager implements OwnCloudClientManager { throws AccountUtils.AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException { OwnCloudVersion ownCloudVersion = null; if (account.getSavedAccount() != null) { ownCloudVersion = AccountUtils.getServerVersionForAccount( account.getSavedAccount(), context ); } if (ownCloudVersion != null && ownCloudVersion.isPreemptiveAuthenticationPreferred()) { return mSingleSessionManager.getClientFor(account, context); } else { return mSimpleFactoryManager.getClientFor(account, context); } } @Override Loading src/com/owncloud/android/lib/common/OwnCloudClientFactory.java +10 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; import com.owncloud.android.lib.common.network.NetworkUtils; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.status.OwnCloudVersion; import java.io.IOException; import java.security.GeneralSecurityException; Loading Loading @@ -110,7 +111,11 @@ public class OwnCloudClientFactory { AccountTypeUtils.getAuthTokenTypePass(account.type), false); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); OwnCloudVersion version = AccountUtils.getServerVersionForAccount(account, appContext); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials( username, password, (version != null && version.isPreemptiveAuthenticationPreferred())); client.setCredentials(credentials); } Loading Loading @@ -183,7 +188,10 @@ public class OwnCloudClientFactory { Bundle result = future.getResult(); String password = result.getString(AccountManager.KEY_AUTHTOKEN); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); OwnCloudVersion version = AccountUtils.getServerVersionForAccount(account, appContext); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials( username, password, (version != null && version.isPreemptiveAuthenticationPreferred())); client.setCredentials(credentials); } Loading src/com/owncloud/android/lib/common/OwnCloudCredentialsFactory.java +5 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,11 @@ public class OwnCloudCredentialsFactory { private static OwnCloudAnonymousCredentials sAnonymousCredentials; public static OwnCloudCredentials newBasicCredentials(String username, String password) { return new OwnCloudBasicCredentials(username, password, true); return new OwnCloudBasicCredentials(username, password); } public static OwnCloudCredentials newBasicCredentials(String username, String password, boolean preemptiveMode) { return new OwnCloudBasicCredentials(username, password, preemptiveMode); } public static OwnCloudCredentials newBearerCredentials(String authToken) { Loading src/com/owncloud/android/lib/common/accounts/AccountUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -231,7 +231,8 @@ public class AccountUtils { AccountTypeUtils.getAuthTokenTypePass(account.type), false); credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password, version.isPreemptiveAuthenticationPreferred()); } return credentials; Loading src/com/owncloud/android/lib/resources/status/OwnCloudVersion.java +4 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,10 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> { return (mVersion >= MINIMUM_VERSION_WITH_NOT_RESHAREABLE_FEDERATED); } public boolean isPreemptiveAuthenticationPreferred() { return (mVersion >= MINIMUM_VERSION_WITH_SESSION_MONITORING); } public boolean isSelfSupported() { return (mVersion >= MINIMUM_VERSION_FOR_SELF_API); } Loading Loading
src/com/owncloud/android/lib/common/DynamicSessionManager.java +13 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ import android.accounts.OperationCanceledException; import android.content.Context; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.resources.status.OwnCloudVersion; import java.io.IOException; Loading @@ -28,7 +29,18 @@ public class DynamicSessionManager implements OwnCloudClientManager { throws AccountUtils.AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException { OwnCloudVersion ownCloudVersion = null; if (account.getSavedAccount() != null) { ownCloudVersion = AccountUtils.getServerVersionForAccount( account.getSavedAccount(), context ); } if (ownCloudVersion != null && ownCloudVersion.isPreemptiveAuthenticationPreferred()) { return mSingleSessionManager.getClientFor(account, context); } else { return mSimpleFactoryManager.getClientFor(account, context); } } @Override Loading
src/com/owncloud/android/lib/common/OwnCloudClientFactory.java +10 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; import com.owncloud.android.lib.common.network.NetworkUtils; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.status.OwnCloudVersion; import java.io.IOException; import java.security.GeneralSecurityException; Loading Loading @@ -110,7 +111,11 @@ public class OwnCloudClientFactory { AccountTypeUtils.getAuthTokenTypePass(account.type), false); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); OwnCloudVersion version = AccountUtils.getServerVersionForAccount(account, appContext); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials( username, password, (version != null && version.isPreemptiveAuthenticationPreferred())); client.setCredentials(credentials); } Loading Loading @@ -183,7 +188,10 @@ public class OwnCloudClientFactory { Bundle result = future.getResult(); String password = result.getString(AccountManager.KEY_AUTHTOKEN); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); OwnCloudVersion version = AccountUtils.getServerVersionForAccount(account, appContext); OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials( username, password, (version != null && version.isPreemptiveAuthenticationPreferred())); client.setCredentials(credentials); } Loading
src/com/owncloud/android/lib/common/OwnCloudCredentialsFactory.java +5 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,11 @@ public class OwnCloudCredentialsFactory { private static OwnCloudAnonymousCredentials sAnonymousCredentials; public static OwnCloudCredentials newBasicCredentials(String username, String password) { return new OwnCloudBasicCredentials(username, password, true); return new OwnCloudBasicCredentials(username, password); } public static OwnCloudCredentials newBasicCredentials(String username, String password, boolean preemptiveMode) { return new OwnCloudBasicCredentials(username, password, preemptiveMode); } public static OwnCloudCredentials newBearerCredentials(String authToken) { Loading
src/com/owncloud/android/lib/common/accounts/AccountUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -231,7 +231,8 @@ public class AccountUtils { AccountTypeUtils.getAuthTokenTypePass(account.type), false); credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password); credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password, version.isPreemptiveAuthenticationPreferred()); } return credentials; Loading
src/com/owncloud/android/lib/resources/status/OwnCloudVersion.java +4 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,10 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> { return (mVersion >= MINIMUM_VERSION_WITH_NOT_RESHAREABLE_FEDERATED); } public boolean isPreemptiveAuthenticationPreferred() { return (mVersion >= MINIMUM_VERSION_WITH_SESSION_MONITORING); } public boolean isSelfSupported() { return (mVersion >= MINIMUM_VERSION_FOR_SELF_API); } Loading