mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Merge pull request #156 from owncloud/support_hidden_version_in_status_php
Allow the usage of OwnCloudVersion instances for invalid server versions
This commit is contained in:
commit
7d49e20258
@ -295,8 +295,6 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
}
|
}
|
||||||
if (destination != null) {
|
if (destination != null) {
|
||||||
int suffixIndex = locationStr.lastIndexOf(
|
int suffixIndex = locationStr.lastIndexOf(
|
||||||
(mCredentials instanceof OwnCloudBearerCredentials) ?
|
|
||||||
AccountUtils.ODAV_PATH :
|
|
||||||
AccountUtils.WEBDAV_PATH_4_0
|
AccountUtils.WEBDAV_PATH_4_0
|
||||||
);
|
);
|
||||||
String redirectionBase = locationStr.substring(0, suffixIndex);
|
String redirectionBase = locationStr.substring(0, suffixIndex);
|
||||||
@ -352,11 +350,7 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Uri getWebdavUri() {
|
public Uri getWebdavUri() {
|
||||||
if (mCredentials instanceof OwnCloudBearerCredentials) {
|
return Uri.parse(mBaseUri + AccountUtils.WEBDAV_PATH_4_0);
|
||||||
return Uri.parse(mBaseUri + AccountUtils.ODAV_PATH);
|
|
||||||
} else {
|
|
||||||
return Uri.parse(mBaseUri + AccountUtils.WEBDAV_PATH_4_0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* ownCloud Android Library is available under MIT license
|
/* ownCloud Android Library is available under MIT license
|
||||||
* Copyright (C) 2016 ownCloud GmbH.
|
* Copyright (C) 2017 ownCloud GmbH.
|
||||||
* Copyright (C) 2012 Bartek Przybylski
|
* Copyright (C) 2012 Bartek Przybylski
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -47,43 +47,9 @@ public class AccountUtils {
|
|||||||
|
|
||||||
private static final String TAG = AccountUtils.class.getSimpleName();
|
private static final String TAG = AccountUtils.class.getSimpleName();
|
||||||
|
|
||||||
public static final String WEBDAV_PATH_1_2 = "/webdav/owncloud.php";
|
|
||||||
public static final String WEBDAV_PATH_2_0 = "/files/webdav.php";
|
|
||||||
public static final String WEBDAV_PATH_4_0 = "/remote.php/webdav";
|
public static final String WEBDAV_PATH_4_0 = "/remote.php/webdav";
|
||||||
public static final String ODAV_PATH = "/remote.php/odav";
|
|
||||||
private static final String SAML_SSO_PATH = "/remote.php/webdav";
|
|
||||||
public static final String CARDDAV_PATH_2_0 = "/apps/contacts/carddav.php";
|
|
||||||
public static final String CARDDAV_PATH_4_0 = "/remote/carddav.php";
|
|
||||||
public static final String STATUS_PATH = "/status.php";
|
public static final String STATUS_PATH = "/status.php";
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the proper URL path to access the WebDAV interface of an ownCloud server,
|
|
||||||
* according to its version and the authorization method used.
|
|
||||||
*
|
|
||||||
* @param supportsOAuth If true, access with OAuth 2 authorization is considered.
|
|
||||||
* @param supportsSamlSso If true, and supportsOAuth is false, access with SAML-based single-sign-on is considered.
|
|
||||||
* @return WebDAV path for given OC version, null if OC version unknown
|
|
||||||
* @param version Version of ownCloud server.
|
|
||||||
*/
|
|
||||||
public static String getWebdavPath(OwnCloudVersion version, boolean supportsOAuth, boolean supportsSamlSso) {
|
|
||||||
if (version != null) {
|
|
||||||
if (supportsOAuth) {
|
|
||||||
return ODAV_PATH;
|
|
||||||
}
|
|
||||||
if (supportsSamlSso) {
|
|
||||||
return SAML_SSO_PATH;
|
|
||||||
}
|
|
||||||
if (version.compareTo(OwnCloudVersion.owncloud_v4) >= 0)
|
|
||||||
return WEBDAV_PATH_4_0;
|
|
||||||
if (version.compareTo(OwnCloudVersion.owncloud_v3) >= 0
|
|
||||||
|| version.compareTo(OwnCloudVersion.owncloud_v2) >= 0)
|
|
||||||
return WEBDAV_PATH_2_0;
|
|
||||||
if (version.compareTo(OwnCloudVersion.owncloud_v1) >= 0)
|
|
||||||
return WEBDAV_PATH_1_2;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs full url to host and webdav resource basing on host version
|
* Constructs full url to host and webdav resource basing on host version
|
||||||
*
|
*
|
||||||
@ -97,16 +63,10 @@ public class AccountUtils {
|
|||||||
public static String constructFullURLForAccount(Context context, Account account) throws AccountNotFoundException {
|
public static String constructFullURLForAccount(Context context, Account account) throws AccountNotFoundException {
|
||||||
AccountManager ama = AccountManager.get(context);
|
AccountManager ama = AccountManager.get(context);
|
||||||
String baseurl = ama.getUserData(account, Constants.KEY_OC_BASE_URL);
|
String baseurl = ama.getUserData(account, Constants.KEY_OC_BASE_URL);
|
||||||
String version = ama.getUserData(account, Constants.KEY_OC_VERSION);
|
if (baseurl == null) {
|
||||||
boolean supportsOAuth = (ama.getUserData(account, Constants.KEY_SUPPORTS_OAUTH2) != null);
|
|
||||||
boolean supportsSamlSso = (ama.getUserData(account, Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null);
|
|
||||||
OwnCloudVersion ver = new OwnCloudVersion(version);
|
|
||||||
String webdavpath = getWebdavPath(ver, supportsOAuth, supportsSamlSso);
|
|
||||||
|
|
||||||
if (baseurl == null || webdavpath == null)
|
|
||||||
throw new AccountNotFoundException(account, "Account not found", null);
|
throw new AccountNotFoundException(account, "Account not found", null);
|
||||||
|
}
|
||||||
return baseurl + webdavpath;
|
return baseurl + WEBDAV_PATH_4_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +63,8 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
|||||||
|
|
||||||
private static final String NODE_INSTALLED = "installed";
|
private static final String NODE_INSTALLED = "installed";
|
||||||
private static final String NODE_VERSION = "version";
|
private static final String NODE_VERSION = "version";
|
||||||
|
private static final String HTTPS_PREFIX = "https://";
|
||||||
|
private static final String HTTP_PREFIX = "http://";
|
||||||
|
|
||||||
private RemoteOperationResult mLatestResult;
|
private RemoteOperationResult mLatestResult;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@ -93,8 +95,8 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
|||||||
&& !mLatestResult.isSuccess()) {
|
&& !mLatestResult.isSuccess()) {
|
||||||
|
|
||||||
isRedirectToNonSecureConnection |= (
|
isRedirectToNonSecureConnection |= (
|
||||||
baseUrlSt.startsWith("https://") &&
|
baseUrlSt.startsWith(HTTPS_PREFIX) &&
|
||||||
redirectedLocation.startsWith("http://")
|
redirectedLocation.startsWith(HTTP_PREFIX)
|
||||||
);
|
);
|
||||||
get.releaseConnection();
|
get.releaseConnection();
|
||||||
get = new GetMethod(redirectedLocation);
|
get = new GetMethod(redirectedLocation);
|
||||||
@ -115,30 +117,26 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
|||||||
} else {
|
} else {
|
||||||
String version = json.getString(NODE_VERSION);
|
String version = json.getString(NODE_VERSION);
|
||||||
OwnCloudVersion ocVersion = new OwnCloudVersion(version);
|
OwnCloudVersion ocVersion = new OwnCloudVersion(version);
|
||||||
if (!ocVersion.isVersionValid()) {
|
/// the version object will be returned even if the version is invalid, no error code;
|
||||||
|
/// every app will decide how to act if (ocVersion.isVersionValid() == false)
|
||||||
|
|
||||||
|
if (isRedirectToNonSecureConnection) {
|
||||||
mLatestResult = new RemoteOperationResult(
|
mLatestResult = new RemoteOperationResult(
|
||||||
RemoteOperationResult.ResultCode.BAD_OC_VERSION);
|
RemoteOperationResult.ResultCode.
|
||||||
|
OK_REDIRECT_TO_NON_SECURE_CONNECTION
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// success
|
mLatestResult = new RemoteOperationResult(
|
||||||
if (isRedirectToNonSecureConnection) {
|
baseUrlSt.startsWith(HTTPS_PREFIX) ?
|
||||||
mLatestResult = new RemoteOperationResult(
|
RemoteOperationResult.ResultCode.OK_SSL :
|
||||||
RemoteOperationResult.ResultCode.
|
RemoteOperationResult.ResultCode.OK_NO_SSL
|
||||||
OK_REDIRECT_TO_NON_SECURE_CONNECTION
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
mLatestResult = new RemoteOperationResult(
|
|
||||||
baseUrlSt.startsWith("https://") ?
|
|
||||||
RemoteOperationResult.ResultCode.OK_SSL :
|
|
||||||
RemoteOperationResult.ResultCode.OK_NO_SSL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Object> data = new ArrayList<Object>();
|
|
||||||
data.add(ocVersion);
|
|
||||||
mLatestResult.setData(data);
|
|
||||||
retval = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArrayList<Object> data = new ArrayList<Object>();
|
||||||
|
data.add(ocVersion);
|
||||||
|
mLatestResult.setData(data);
|
||||||
|
retval = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -184,15 +182,15 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
|||||||
return new RemoteOperationResult(RemoteOperationResult.ResultCode.NO_NETWORK_CONNECTION);
|
return new RemoteOperationResult(RemoteOperationResult.ResultCode.NO_NETWORK_CONNECTION);
|
||||||
}
|
}
|
||||||
String baseUriStr = client.getBaseUri().toString();
|
String baseUriStr = client.getBaseUri().toString();
|
||||||
if (baseUriStr.startsWith("http://") || baseUriStr.startsWith("https://")) {
|
if (baseUriStr.startsWith(HTTP_PREFIX) || baseUriStr.startsWith(HTTPS_PREFIX)) {
|
||||||
tryConnection(client);
|
tryConnection(client);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
client.setBaseUri(Uri.parse("https://" + baseUriStr));
|
client.setBaseUri(Uri.parse(HTTPS_PREFIX + baseUriStr));
|
||||||
boolean httpsSuccess = tryConnection(client);
|
boolean httpsSuccess = tryConnection(client);
|
||||||
if (!httpsSuccess && !mLatestResult.isSslRecoverableException()) {
|
if (!httpsSuccess && !mLatestResult.isSslRecoverableException()) {
|
||||||
Log_OC.d(TAG, "establishing secure connection failed, trying non secure connection");
|
Log_OC.d(TAG, "establishing secure connection failed, trying non secure connection");
|
||||||
client.setBaseUri(Uri.parse("http://" + baseUriStr));
|
client.setBaseUri(Uri.parse(HTTP_PREFIX + baseUriStr));
|
||||||
tryConnection(client);
|
tryConnection(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,16 +26,6 @@
|
|||||||
package com.owncloud.android.lib.resources.status;
|
package com.owncloud.android.lib.resources.status;
|
||||||
|
|
||||||
public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
||||||
public static final OwnCloudVersion owncloud_v1 = new OwnCloudVersion(
|
|
||||||
0x01000000);
|
|
||||||
public static final OwnCloudVersion owncloud_v2 = new OwnCloudVersion(
|
|
||||||
0x02000000);
|
|
||||||
public static final OwnCloudVersion owncloud_v3 = new OwnCloudVersion(
|
|
||||||
0x03000000);
|
|
||||||
public static final OwnCloudVersion owncloud_v4 = new OwnCloudVersion(
|
|
||||||
0x04000000);
|
|
||||||
public static final OwnCloudVersion owncloud_v4_5 = new OwnCloudVersion(
|
|
||||||
0x04050000);
|
|
||||||
|
|
||||||
public static final int MINIMUN_VERSION_FOR_CHUNKED_UPLOADS = 0x04050000; // 4.5
|
public static final int MINIMUN_VERSION_FOR_CHUNKED_UPLOADS = 0x04050000; // 4.5
|
||||||
|
|
||||||
@ -56,7 +46,9 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
private static final int MINIMUM_VERSION_WITH_SESSION_MONITORING = 0x09010000; // 9.1
|
private static final int MINIMUM_VERSION_WITH_SESSION_MONITORING = 0x09010000; // 9.1
|
||||||
|
|
||||||
private static final int MINIMUM_VERSION_WITH_SESSION_MONITORING_WORKING_IN_PREEMPTIVE_MODE = 0x09010301;
|
private static final int MINIMUM_VERSION_WITH_SESSION_MONITORING_WORKING_IN_PREEMPTIVE_MODE = 0x09010301;
|
||||||
// 9.1.3.1, final 9.1.3: https://github.com/owncloud/core/commit/f9a867b70c217463289a741d4d26079eb2a80dfd
|
// 9.1.3.1, final 9.1.3: https://github.com/owncloud/core/commit/f9a867b70c217463289a741d4d26079eb2a80dfd
|
||||||
|
|
||||||
|
private static final String INVALID_ZERO_VERSION = "0.0.0";
|
||||||
|
|
||||||
private static final int MAX_DOTS = 3;
|
private static final int MAX_DOTS = 3;
|
||||||
|
|
||||||
@ -67,35 +59,48 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
private int mVersion;
|
private int mVersion;
|
||||||
private boolean mIsValid;
|
private boolean mIsValid;
|
||||||
|
|
||||||
protected OwnCloudVersion(int version) {
|
/**
|
||||||
|
* @deprecated Will be removed in version 1.0 of the library.
|
||||||
|
*/
|
||||||
|
private OwnCloudVersion(int version) {
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
mIsValid = true;
|
mIsValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnCloudVersion(String version){
|
public OwnCloudVersion(String version) {
|
||||||
mVersion = 0;
|
mVersion = 0;
|
||||||
mIsValid = false;
|
mIsValid = false;
|
||||||
int countDots = version.length() - version.replace(".", "").length();
|
int countDots = version.length() - version.replace(".", "").length();
|
||||||
|
|
||||||
// Complete the version. Version must have 3 dots
|
// Complete the version. Version must have 3 dots
|
||||||
for (int i = countDots; i < MAX_DOTS; i++) {
|
for (int i = countDots; i < MAX_DOTS; i++) {
|
||||||
version = version + ".0";
|
version = version + ".0";
|
||||||
}
|
}
|
||||||
|
|
||||||
parseVersion(version);
|
parseVersion(version);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String versionToString = String.valueOf((mVersion >> (8*MAX_DOTS)) % 256);
|
// gets the first digit of version, shifting hexadecimal version to right 'til max position
|
||||||
for (int i = MAX_DOTS - 1; i >= 0; i-- ) {
|
String versionToString = String.valueOf((mVersion >> (8 * MAX_DOTS)) % 256);
|
||||||
versionToString = versionToString + "." + String.valueOf((mVersion >> (8*i)) % 256);
|
for (int i = MAX_DOTS - 1; i >= 0; i--) {
|
||||||
}
|
// gets another digit of version, shifting hexadecimal version to right 8*i bits and...
|
||||||
|
// ...discarding left part with mod 256
|
||||||
|
versionToString = versionToString + "." + String.valueOf((mVersion >> (8 * i)) % 256);
|
||||||
|
}
|
||||||
|
if (!mIsValid) {
|
||||||
|
versionToString += " INVALID";
|
||||||
|
}
|
||||||
return versionToString;
|
return versionToString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return toString();
|
if (mIsValid) {
|
||||||
|
return toString();
|
||||||
|
} else {
|
||||||
|
return INVALID_ZERO_VERSION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersionValid() {
|
public boolean isVersionValid() {
|
||||||
@ -105,34 +110,37 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
@Override
|
@Override
|
||||||
public int compareTo(OwnCloudVersion another) {
|
public int compareTo(OwnCloudVersion another) {
|
||||||
return another.mVersion == mVersion ? 0
|
return another.mVersion == mVersion ? 0
|
||||||
: another.mVersion < mVersion ? 1 : -1;
|
: another.mVersion < mVersion ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseVersion(String version) {
|
private void parseVersion(String version) {
|
||||||
try {
|
try {
|
||||||
mVersion = getParsedVersion(version);
|
mVersion = getParsedVersion(version);
|
||||||
mIsValid = true;
|
mIsValid = true;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mIsValid = false;
|
mIsValid = false;
|
||||||
|
// if invalid, the instance will respond as if server is 8.1, minimum with capabilities API,
|
||||||
|
// and "dead" : https://github.com/owncloud/core/wiki/Maintenance-and-Release-Schedule
|
||||||
|
mVersion = MINIMUM_VERSION_CAPABILITIES_API;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getParsedVersion(String version) throws NumberFormatException {
|
private int getParsedVersion(String version) throws NumberFormatException {
|
||||||
int versionValue = 0;
|
int versionValue = 0;
|
||||||
|
|
||||||
// get only numeric part
|
// get only numeric part
|
||||||
version = version.replaceAll("[^\\d.]", "");
|
version = version.replaceAll("[^\\d.]", "");
|
||||||
|
|
||||||
String[] nums = version.split("\\.");
|
String[] nums = version.split("\\.");
|
||||||
for (int i = 0; i < nums.length && i <= MAX_DOTS; i++) {
|
for (int i = 0; i < nums.length && i <= MAX_DOTS; i++) {
|
||||||
versionValue += Integer.parseInt(nums[i]);
|
versionValue += Integer.parseInt(nums[i]);
|
||||||
if (i < nums.length - 1) {
|
if (i < nums.length - 1) {
|
||||||
versionValue = versionValue << 8;
|
versionValue = versionValue << 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return versionValue;
|
return versionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +149,7 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSharedSupported() {
|
public boolean isSharedSupported() {
|
||||||
return (mVersion >= MINIMUM_VERSION_FOR_SHARING_API);
|
return (mVersion >= MINIMUM_VERSION_FOR_SHARING_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersionWithForbiddenCharacters() {
|
public boolean isVersionWithForbiddenCharacters() {
|
||||||
@ -152,7 +160,7 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
return (mVersion >= MINIMUM_SERVER_VERSION_FOR_REMOTE_THUMBNAILS);
|
return (mVersion >= MINIMUM_SERVER_VERSION_FOR_REMOTE_THUMBNAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAfter8Version(){
|
public boolean isAfter8Version() {
|
||||||
return (mVersion >= VERSION_8);
|
return (mVersion >= VERSION_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,8 +168,8 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
return (mVersion >= MINIMUM_VERSION_FOR_SEARCHING_USERS);
|
return (mVersion >= MINIMUM_VERSION_FOR_SEARCHING_USERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersionWithCapabilitiesAPI(){
|
public boolean isVersionWithCapabilitiesAPI() {
|
||||||
return (mVersion>= MINIMUM_VERSION_CAPABILITIES_API);
|
return (mVersion >= MINIMUM_VERSION_CAPABILITIES_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNotReshareableFederatedSupported() {
|
public boolean isNotReshareableFederatedSupported() {
|
||||||
@ -177,11 +185,11 @@ public class OwnCloudVersion implements Comparable<OwnCloudVersion> {
|
|||||||
* mode of basic authentication is disabled. This changes in OC 9.1.3, where preemptive mode is compatible
|
* mode of basic authentication is disabled. This changes in OC 9.1.3, where preemptive mode is compatible
|
||||||
* with session tracking again.
|
* with session tracking again.
|
||||||
*
|
*
|
||||||
* @return True for every version before 9.1 and from 9.1.3, false otherwise
|
* @return True for every version before 9.1 and from 9.1.3, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isPreemptiveAuthenticationPreferred() {
|
public boolean isPreemptiveAuthenticationPreferred() {
|
||||||
return (
|
return (
|
||||||
(mVersion < MINIMUM_VERSION_WITH_SESSION_MONITORING) ||
|
(mVersion < MINIMUM_VERSION_WITH_SESSION_MONITORING) ||
|
||||||
(mVersion >= MINIMUM_VERSION_WITH_SESSION_MONITORING_WORKING_IN_PREEMPTIVE_MODE)
|
(mVersion >= MINIMUM_VERSION_WITH_SESSION_MONITORING_WORKING_IN_PREEMPTIVE_MODE)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -296,9 +296,8 @@ public class OwnCloudClientTest extends AndroidTestCase {
|
|||||||
new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager());
|
new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager());
|
||||||
client.setCredentials(OwnCloudCredentialsFactory.newBearerCredentials("fakeToken"));
|
client.setCredentials(OwnCloudCredentialsFactory.newBearerCredentials("fakeToken"));
|
||||||
Uri webdavUri = client.getWebdavUri();
|
Uri webdavUri = client.getWebdavUri();
|
||||||
assertTrue("WebDAV URI does not point to the right entry point for OAuth2 " +
|
assertTrue("WebDAV URI does not point to the right entry point",
|
||||||
"authenticated servers",
|
webdavUri.getPath().endsWith(AccountUtils.WEBDAV_PATH_4_0));
|
||||||
webdavUri.getPath().endsWith(AccountUtils.ODAV_PATH));
|
|
||||||
assertTrue("WebDAV URI is not a subpath of base URI",
|
assertTrue("WebDAV URI is not a subpath of base URI",
|
||||||
webdavUri.getAuthority().equals(mServerUri.getAuthority()) &&
|
webdavUri.getAuthority().equals(mServerUri.getAuthority()) &&
|
||||||
webdavUri.getPath().startsWith(mServerUri.getPath()));
|
webdavUri.getPath().startsWith(mServerUri.getPath()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user