X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/aa23ece118de680a4f288602f83b25a433c99d12..2c1b67e14329f4d9c046253410012107e9d65f28:/src/eu/alefzero/webdav/WebdavClient.java?ds=sidebyside diff --git a/src/eu/alefzero/webdav/WebdavClient.java b/src/eu/alefzero/webdav/WebdavClient.java index 2ab5a69c..8c54a53d 100644 --- a/src/eu/alefzero/webdav/WebdavClient.java +++ b/src/eu/alefzero/webdav/WebdavClient.java @@ -41,11 +41,11 @@ import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.http.HttpStatus; import org.apache.http.params.CoreProtocolPNames; -import com.owncloud.android.Log_OC; -import com.owncloud.android.authentication.AccountAuthenticator; -import com.owncloud.android.network.BearerAuthScheme; -import com.owncloud.android.network.BearerCredentials; +import de.mobilcom.debitel.cloud.android.Log_OC; +import de.mobilcom.debitel.cloud.android.MainApp; +import de.mobilcom.debitel.cloud.android.network.BearerAuthScheme; +import de.mobilcom.debitel.cloud.android.network.BearerCredentials; import android.net.Uri; @@ -72,7 +72,7 @@ public class WebdavClient extends HttpClient { getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); mFollowRedirects = true; mSsoSessionCookie = null; - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD; + mAuthTokenType = MainApp.getAuthTokenTypePass(); } public void setBearerCredentials(String accessToken) { @@ -85,7 +85,7 @@ public class WebdavClient extends HttpClient { mCredentials = new BearerCredentials(accessToken); getState().setCredentials(AuthScope.ANY, mCredentials); mSsoSessionCookie = null; - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN; + mAuthTokenType = MainApp.getAuthTokenTypeAccessToken(); } public void setBasicCredentials(String username, String password) { @@ -97,7 +97,7 @@ public class WebdavClient extends HttpClient { mCredentials = new UsernamePasswordCredentials(username, password); getState().setCredentials(AuthScope.ANY, mCredentials); mSsoSessionCookie = null; - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD; + mAuthTokenType = MainApp.getAuthTokenTypePass(); } public void setSsoSessionCookie(String accessToken) { @@ -105,7 +105,7 @@ public class WebdavClient extends HttpClient { getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES); mSsoSessionCookie = accessToken; mCredentials = null; - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE; + mAuthTokenType = MainApp.getAuthTokenTypeSamlSessionCookie(); } @@ -168,21 +168,21 @@ public class WebdavClient extends HttpClient { try { method.setFollowRedirects(mFollowRedirects); } catch (Exception e) { - Log_OC.d(TAG, "setFollowRedirects failed for " + method.getName() + " method, custom redirection will be used"); - customRedirectionNeeded = true; + if (mFollowRedirects) Log_OC.d(TAG, "setFollowRedirects failed for " + method.getName() + " method, custom redirection will be used"); + customRedirectionNeeded = mFollowRedirects; } if (mSsoSessionCookie != null && mSsoSessionCookie.length() > 0) { method.setRequestHeader("Cookie", mSsoSessionCookie); } int status = super.executeMethod(method); int redirectionsCount = 0; - while (mFollowRedirects && + while (customRedirectionNeeded && redirectionsCount < MAX_REDIRECTIONS_COUNT && - customRedirectionNeeded && ( status == HttpStatus.SC_MOVED_PERMANENTLY || status == HttpStatus.SC_MOVED_TEMPORARILY || status == HttpStatus.SC_TEMPORARY_REDIRECT) ) { + Header location = method.getResponseHeader("Location"); if (location != null) { Log_OC.d(TAG, "Location to redirect: " + location.getValue());