projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
78bcf72
)
Expiration of SSO session is detected in background operations (download, upload...
author
David A. Velasco
<dvelasco@solidgear.es>
Mon, 12 Aug 2013 09:34:09 +0000
(11:34 +0200)
committer
David A. Velasco
<dvelasco@solidgear.es>
Mon, 12 Aug 2013 09:34:09 +0000
(11:34 +0200)
res/values/setup.xml
patch
|
blob
|
blame
|
history
src/com/owncloud/android/files/services/FileDownloader.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/files/services/FileUploader.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
patch
|
blob
|
blame
|
history
src/eu/alefzero/webdav/WebdavClient.java
patch
|
blob
|
blame
|
history
diff --git
a/res/values/setup.xml
b/res/values/setup.xml
index
3e39fab
..
f398241
100644
(file)
--- a/
res/values/setup.xml
+++ b/
res/values/setup.xml
@@
-1,6
+1,6
@@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="server_url">https://bwlsdf-owncloud1.lsdf.kit.edu/oc-shib</string>
+ <string name="server_url">https://bwlsdf-owncloud1.lsdf.kit.edu/oc-shib
-dev
</string>
<bool name="show_server_url_input">true</bool>
<!-- Flags to setup the authentication methods available in the app -->
<bool name="show_server_url_input">true</bool>
<!-- Flags to setup the authentication methods available in the app -->
diff --git
a/src/com/owncloud/android/files/services/FileDownloader.java
b/src/com/owncloud/android/files/services/FileDownloader.java
index
02a8a45
..
9410e6d
100644
(file)
--- a/
src/com/owncloud/android/files/services/FileDownloader.java
+++ b/
src/com/owncloud/android/files/services/FileDownloader.java
@@
-28,6
+28,7
@@
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@@
-463,7
+464,8
@@
public class FileDownloader extends Service implements OnDatatransferProgressLis
int contentId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_content : R.string.downloader_download_failed_content;
Notification finalNotification = new Notification(R.drawable.icon, getString(tickerId), System.currentTimeMillis());
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
int contentId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_content : R.string.downloader_download_failed_content;
Notification finalNotification = new Notification(R.drawable.icon, getString(tickerId), System.currentTimeMillis());
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
- boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED);
+ boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
+ (downloadResult.isTemporalRedirection() && AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mDownloadClient.getAuthTokenType())));
if (needsToUpdateCredentials) {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
if (needsToUpdateCredentials) {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
diff --git
a/src/com/owncloud/android/files/services/FileUploader.java
b/src/com/owncloud/android/files/services/FileUploader.java
index
96c7fdc
..
6b12fa5
100644
(file)
--- a/
src/com/owncloud/android/files/services/FileUploader.java
+++ b/
src/com/owncloud/android/files/services/FileUploader.java
@@
-791,7
+791,8
@@
public class FileUploader extends Service implements OnDatatransferProgressListe
Notification finalNotification = new Notification(R.drawable.icon,
getString(R.string.uploader_upload_failed_ticker), System.currentTimeMillis());
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
Notification finalNotification = new Notification(R.drawable.icon,
getString(R.string.uploader_upload_failed_ticker), System.currentTimeMillis());
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
- if (uploadResult.getCode() == ResultCode.UNAUTHORIZED) {
+ if (uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
+ (uploadResult.isTemporalRedirection() && AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mUploadClient.getAuthTokenType()))) {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount());
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount());
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index
8653fe7
..
2bf135b
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@
-28,6
+28,7
@@
import org.apache.jackrabbit.webdav.DavException;
import com.owncloud.android.Log_OC;
import com.owncloud.android.R;
import com.owncloud.android.Log_OC;
import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.DataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.DataStorageManager;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@
-223,7
+224,8
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
sendStickyBroadcast(true, remotePath, null);
} else {
sendStickyBroadcast(true, remotePath, null);
} else {
- if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED) {
+ if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
+ (result.isTemporalRedirection() && getClient().getSsoSessionCookie() != null)) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
@@
-304,7
+306,11
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
private void notifyFailedSynchronization() {
Notification notification = new Notification(R.drawable.icon, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
private void notifyFailedSynchronization() {
Notification notification = new Notification(R.drawable.icon, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
- boolean needsToUpdateCredentials = (mLastFailedResult != null && mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED);
+ boolean needsToUpdateCredentials = (mLastFailedResult != null &&
+ ( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
+ (mLastFailedResult.isTemporalRedirection() && AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))
+ )
+ );
// TODO put something smart in the contentIntent below for all the possible errors
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
if (needsToUpdateCredentials) {
// TODO put something smart in the contentIntent below for all the possible errors
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
if (needsToUpdateCredentials) {
diff --git
a/src/eu/alefzero/webdav/WebdavClient.java
b/src/eu/alefzero/webdav/WebdavClient.java
index
43a6743
..
dd48408
100644
(file)
--- a/
src/eu/alefzero/webdav/WebdavClient.java
+++ b/
src/eu/alefzero/webdav/WebdavClient.java
@@
-41,9
+41,11
@@
import org.apache.http.params.CoreProtocolPNames;
import com.owncloud.android.Log_OC;
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 com.owncloud.android.network.BearerAuthScheme;
import com.owncloud.android.network.BearerCredentials;
+import android.accounts.AccountAuthenticatorActivity;
import android.net.Uri;
public class WebdavClient extends HttpClient {
import android.net.Uri;
public class WebdavClient extends HttpClient {
@@
-51,6
+53,7
@@
public class WebdavClient extends HttpClient {
private Credentials mCredentials;
private boolean mFollowRedirects;
private String mSsoSessionCookie;
private Credentials mCredentials;
private boolean mFollowRedirects;
private String mSsoSessionCookie;
+ private String mAuthTokenType;
final private static String TAG = "WebdavClient";
public static final String USER_AGENT = "Android-ownCloud";
final private static String TAG = "WebdavClient";
public static final String USER_AGENT = "Android-ownCloud";
@@
-66,6
+69,7
@@
public class WebdavClient extends HttpClient {
getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
mFollowRedirects = true;
mSsoSessionCookie = null;
getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
mFollowRedirects = true;
mSsoSessionCookie = null;
+ mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD;
}
public void setBearerCredentials(String accessToken) {
}
public void setBearerCredentials(String accessToken) {
@@
-78,6
+82,7
@@
public class WebdavClient extends HttpClient {
mCredentials = new BearerCredentials(accessToken);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
mCredentials = new BearerCredentials(accessToken);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
+ mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN;
}
public void setBasicCredentials(String username, String password) {
}
public void setBasicCredentials(String username, String password) {
@@
-89,6
+94,7
@@
public class WebdavClient extends HttpClient {
mCredentials = new UsernamePasswordCredentials(username, password);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
mCredentials = new UsernamePasswordCredentials(username, password);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
+ mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD;
}
public void setSsoSessionCookie(String accessToken) {
}
public void setSsoSessionCookie(String accessToken) {
@@
-96,6
+102,7
@@
public class WebdavClient extends HttpClient {
getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
mSsoSessionCookie = accessToken;
mCredentials = null;
getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
mSsoSessionCookie = accessToken;
mCredentials = null;
+ mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE;
}
}
@@
-215,4
+222,8
@@
public class WebdavClient extends HttpClient {
mFollowRedirects = followRedirects;
}
mFollowRedirects = followRedirects;
}
+ public String getAuthTokenType() {
+ return mAuthTokenType;
+ }
+
}
}