}
private Context mContext;
- private String mWebDavUrl;
/**
* Constructor
* @param context Android context of the caller.
* @param webdavUrl
*/
- public DetectAuthenticationMethodOperation(Context context, String webdavUrl) {
+ public DetectAuthenticationMethodOperation(Context context) {
mContext = context;
- mWebDavUrl = webdavUrl;
}
AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN;
RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false);
- client.setWebdavUri(Uri.parse(mWebDavUrl));
- client.setBasicCredentials("", "");
+ client.clearCredentials();
client.setFollowRedirects(false);
// try to access the root folder, following redirections but not SAML SSO redirections
result = operation.execute(client);
String redirectedLocation = result.getRedirectedLocation();
- while (redirectedLocation != null && redirectedLocation.length() > 0 && !result.isIdPRedirection()) {
- client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
+ while (redirectedLocation != null && redirectedLocation.length() > 0 &&
+ !result.isIdPRedirection()) {
+ client.setBaseUri(Uri.parse(result.getRedirectedLocation()));
result = operation.execute(client);
redirectedLocation = result.getRedirectedLocation();
}
// else - fall back to UNKNOWN
Log.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
+ if (!authMethod.equals(AuthenticationMethod.UNKNOWN)) {
+ result = new RemoteOperationResult(true, result.getHttpCode(), null);
+ }
ArrayList<Object> data = new ArrayList<Object>();
data.add(authMethod);
result.setData(data);