diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.java index 04b1f69a..38fb11e4 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.java @@ -11,7 +11,7 @@ import java.io.IOException; /** * Dynamic implementation of {@link OwnCloudClientManager}. - *
+ *
* Wraps instances of {@link SingleSessionManager} and {@link SimpleFactoryManager} and delegates on one
* or the other depending on the known version of the server corresponding to the {@link OwnCloudAccount}
*
@@ -60,4 +60,4 @@ public class DynamicSessionManager implements OwnCloudClientManager {
mSimpleFactoryManager.saveAllClients(context, accountType);
mSingleSessionManager.saveAllClients(context, accountType);
}
-}
\ No newline at end of file
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java
index e0a48f19..d036214d 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java
@@ -114,7 +114,7 @@ public class OwnCloudClient extends HttpClient {
status = method.execute();
checkFirstRedirection(method);
- if (mFollowRedirects && !isIdPRedirection()) {
+ if (mFollowRedirects) {
status = followRedirection(method).getLastStatus();
}
@@ -422,7 +422,7 @@ public class OwnCloudClient extends HttpClient {
*/
private boolean shouldInvalidateAccountCredentials(int httpStatusCode) {
- boolean should = (httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED || isIdPRedirection()); // invalid credentials
+ boolean should = (httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED); // invalid credentials
should &= (mCredentials != null && // real credentials
!(mCredentials instanceof OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials));
@@ -459,17 +459,6 @@ public class OwnCloudClient extends HttpClient {
mOwnCloudClientManager = clientManager;
}
- /**
- * Check if the redirection is to an identity provider such as SAML or wayf
- *
- * @return true if the redirection location includes SAML or wayf, false otherwise
- */
- private boolean isIdPRedirection() {
- return (mRedirectedLocation != null &&
- (mRedirectedLocation.toUpperCase().contains("SAML") ||
- mRedirectedLocation.toLowerCase().contains("wayf")));
- }
-
public boolean followRedirects() {
return mFollowRedirects;
}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
index b66bc249..14944a15 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
@@ -1,5 +1,5 @@
/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2016 ownCloud GmbH.
+ * Copyright (C) 2019 ownCloud GmbH.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -38,9 +38,6 @@ public class OwnCloudClientManagerFactory {
case ALWAYS_NEW_CLIENT:
return new SimpleFactoryManager();
- case SINGLE_SESSION_PER_ACCOUNT:
- return new SingleSessionManager();
-
case SINGLE_SESSION_PER_ACCOUNT_IF_SERVER_SUPPORTS_SERVER_MONITORING:
return new DynamicSessionManager();
@@ -82,15 +79,11 @@ public class OwnCloudClientManagerFactory {
if (sDefaultSingleton == null) {
return false;
}
- if (policy == Policy.ALWAYS_NEW_CLIENT && !(sDefaultSingleton instanceof SimpleFactoryManager)) {
- return true;
- }
- return policy == Policy.SINGLE_SESSION_PER_ACCOUNT && !(sDefaultSingleton instanceof SingleSessionManager);
+ return policy == Policy.ALWAYS_NEW_CLIENT && !(sDefaultSingleton instanceof SimpleFactoryManager);
}
public enum Policy {
ALWAYS_NEW_CLIENT,
- SINGLE_SESSION_PER_ACCOUNT,
SINGLE_SESSION_PER_ACCOUNT_IF_SERVER_SUPPORTS_SERVER_MONITORING
}
-}
\ No newline at end of file
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/SingleSessionManager.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/SingleSessionManager.java
index 630ba7f7..21bdf925 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/SingleSessionManager.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/SingleSessionManager.java
@@ -33,7 +33,6 @@ import android.net.Uri;
import android.util.Log;
import com.owncloud.android.lib.common.accounts.AccountUtils;
-import com.owncloud.android.lib.common.authentication.OwnCloudSamlSsoCredentials;
import com.owncloud.android.lib.common.http.HttpClient;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -116,10 +115,6 @@ public class SingleSessionManager implements OwnCloudClientManager {
account.loadCredentials(context);
client.setCredentials(account.getCredentials());
- if (client.getCredentials() instanceof OwnCloudSamlSsoCredentials) {
- client.disableAutomaticCookiesHandling();
- }
-
if (accountName != null) {
mClientsWithKnownUsername.put(accountName, client);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
@@ -226,4 +221,4 @@ public class SingleSessionManager implements OwnCloudClientManager {
reusedClient.setBaseUri(recentUri);
}
}
-}
\ No newline at end of file
+}
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudCredentialsFactory.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudCredentialsFactory.java
index 5ac44517..822ef760 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudCredentialsFactory.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudCredentialsFactory.java
@@ -48,10 +48,6 @@ public class OwnCloudCredentialsFactory {
return new OwnCloudBearerCredentials(username, authToken);
}
- public static OwnCloudCredentials newSamlSsoCredentials(String username, String sessionCookie) {
- return new OwnCloudSamlSsoCredentials(username, sessionCookie);
- }
-
public static final OwnCloudCredentials getAnonymousCredentials() {
if (sAnonymousCredentials == null) {
sAnonymousCredentials = new OwnCloudAnonymousCredentials();
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudSamlSsoCredentials.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudSamlSsoCredentials.java
deleted file mode 100644
index 40f77bb3..00000000
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/OwnCloudSamlSsoCredentials.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2019 ownCloud GmbH.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-package com.owncloud.android.lib.common.authentication;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.http.HttpClient;
-import com.owncloud.android.lib.common.http.HttpConstants;
-
-public class OwnCloudSamlSsoCredentials implements OwnCloudCredentials {
-
- private String mUsername;
- private String mSessionCookie;
-
- public OwnCloudSamlSsoCredentials(String username, String sessionCookie) {
- mUsername = username != null ? username : "";
- mSessionCookie = sessionCookie != null ? sessionCookie : "";
- }
-
- @Override
- public void applyTo(OwnCloudClient client) {
- // Clear previous credentials
- HttpClient.deleteHeaderForAllRequests(HttpConstants.AUTHORIZATION_HEADER);
- HttpClient.deleteHeaderForAllRequests(HttpConstants.COOKIE_HEADER);
-
- HttpClient.addHeaderForAllRequests(HttpConstants.COOKIE_HEADER, mSessionCookie);
- client.setFollowRedirects(false);
- }
-
- @Override
- public String getUsername() {
- // not relevant for authentication, but relevant for informational purposes
- return mUsername;
- }
-
- @Override
- public String getAuthToken() {
- return mSessionCookie;
- }
-
- @Override
- public boolean authTokenExpires() {
- return true;
- }
-
- @Override
- public boolean authTokenCanBeRefreshed() {
- return false;
- }
-}
\ No newline at end of file
diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java
index 2ae646fb..b58d1b73 100644
--- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java
+++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java
@@ -254,10 +254,6 @@ public class RemoteOperationResult