1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Start working on login usecase

This commit is contained in:
Abel García de Prada 2020-02-03 15:28:49 +01:00 committed by davigonz
parent ec5c9fc4aa
commit 3829a1ca32
2 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,7 @@ public class RemoteOperationResult<T>
private Exception mException = null; private Exception mException = null;
private ResultCode mCode = ResultCode.UNKNOWN_ERROR; private ResultCode mCode = ResultCode.UNKNOWN_ERROR;
private String mRedirectedLocation; private String mRedirectedLocation;
private ArrayList<String> mAuthenticate = new ArrayList<>(); private String mAuthenticate;
private String mLastPermanentLocation = null; private String mLastPermanentLocation = null;
private T mData = null; private T mData = null;
@ -253,7 +253,7 @@ public class RemoteOperationResult<T>
continue; continue;
} }
if ("www-authenticate".equals(header.getKey().toLowerCase())) { if ("www-authenticate".equals(header.getKey().toLowerCase())) {
mAuthenticate.add(header.getValue().get(0).toLowerCase()); mAuthenticate = header.getValue().get(0).toLowerCase();
} }
} }
} }
@ -494,7 +494,7 @@ public class RemoteOperationResult<T>
return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://"))); return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://")));
} }
public ArrayList<String> getAuthenticateHeaders() { public String getAuthenticateHeaders() {
return mAuthenticate; return mAuthenticate;
} }

View File

@ -56,7 +56,7 @@ class CheckPathExistenceOperation(
* *
* @return Sequence of redirections followed, if any, or NULL if the operation was not executed. * @return Sequence of redirections followed, if any, or NULL if the operation was not executed.
*/ */
lateinit var redirectionPath: RedirectionPath var redirectionPath: RedirectionPath? = null
private set private set
override fun run(client: OwnCloudClient): RemoteOperationResult<Any> { override fun run(client: OwnCloudClient): RemoteOperationResult<Any> {
@ -75,7 +75,7 @@ class CheckPathExistenceOperation(
var status = client.executeHttpMethod(propFindMethod) var status = client.executeHttpMethod(propFindMethod)
if (previousFollowRedirects) { if (previousFollowRedirects) {
redirectionPath = client.followRedirection(propFindMethod) redirectionPath = client.followRedirection(propFindMethod)
status = redirectionPath.lastStatus status = redirectionPath?.lastStatus!!
} }
/* PROPFIND method /* PROPFIND method
* 404 NOT FOUND: path doesn't exist, * 404 NOT FOUND: path doesn't exist,
@ -103,7 +103,7 @@ class CheckPathExistenceOperation(
/** /**
* @return 'True' if the operation was executed and at least one redirection was followed. * @return 'True' if the operation was executed and at least one redirection was followed.
*/ */
fun wasRedirected() = redirectionPath.redirectionsCount > 0 fun wasRedirected() = (redirectionPath!=null && redirectionPath!!.redirectionsCount > 0)
private fun isSuccess(status: Int) = status == HttpConstants.HTTP_OK || status == HttpConstants.HTTP_MULTI_STATUS private fun isSuccess(status: Int) = status == HttpConstants.HTTP_OK || status == HttpConstants.HTTP_MULTI_STATUS