1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-17 03:12:54 +00:00

Detect when there is a change bewwen a https connection to a non-secure one and generated a new erro code.

This commit is contained in:
jabarros
2014-08-04 10:18:21 +02:00
parent 6b155fb802
commit fe6f99ea6a
2 changed files with 52 additions and 12 deletions
@@ -100,7 +100,8 @@ public class RemoteOperationResult implements Serializable {
SHARE_NOT_FOUND,
LOCAL_STORAGE_NOT_REMOVED,
FORBIDDEN,
SHARE_FORBIDDEN
SHARE_FORBIDDEN,
OK_REDIRECT_TO_NON_SECURE_CONNECTION
}
private boolean mSuccess = false;
@@ -114,7 +115,7 @@ public class RemoteOperationResult implements Serializable {
public RemoteOperationResult(ResultCode code) {
mCode = code;
mSuccess = (code == ResultCode.OK || code == ResultCode.OK_SSL || code == ResultCode.OK_NO_SSL);
mSuccess = (code == ResultCode.OK || code == ResultCode.OK_SSL || code == ResultCode.OK_NO_SSL || code == ResultCode.OK_REDIRECT_TO_NON_SECURE_CONNECTION);
mData = null;
}
@@ -250,6 +251,10 @@ public class RemoteOperationResult implements Serializable {
return mCode == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED;
}
public boolean isRedirectToNonSecureConnection() {
return mCode == ResultCode.OK_REDIRECT_TO_NON_SECURE_CONNECTION;
}
private CertificateCombinedException getCertificateCombinedException(Exception e) {
CertificateCombinedException result = null;
if (e instanceof CertificateCombinedException) {
@@ -371,6 +376,15 @@ public class RemoteOperationResult implements Serializable {
mRedirectedLocation.toLowerCase().contains("wayf")));
}
/**
* Checks if is a non https connection
*
* @return boolean true/false
*/
public boolean isNonSecureRedirection() {
return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://")));
}
public String getAuthenticateHeader() {
return mAuthenticate;
}