Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 8f62925

Browse files
authored
Merge pull request #315 from owncloud/oidc_new_arch
Open Id Connect along with new arch in login
2 parents 64bfd6a + d957d48 commit 8f62925

File tree

4 files changed

+19
-99
lines changed

4 files changed

+19
-99
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/accounts/AccountUtils.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ public static class Constants {
292292
/**
293293
* Flag signaling if the ownCloud server can be accessed with OAuth2 access tokens.
294294
*/
295+
296+
// TODO Please review this constants, move them out of the library, the rest of OAuth variables are in data layer
295297
public static final String KEY_SUPPORTS_OAUTH2 = "oc_supports_oauth2";
296298

297299
public static final String OAUTH_SUPPORTED_TRUE = "TRUE";
@@ -316,21 +318,6 @@ public static class Constants {
316318
*/
317319
public static final String KEY_DISPLAY_NAME = "oc_display_name";
318320

319-
/**
320-
* OAuth2 user id
321-
**/
322-
public static final String KEY_USER_ID = "user_id";
323-
324-
/**
325-
* OAuth2 refresh token
326-
**/
327-
public static final String KEY_OAUTH2_REFRESH_TOKEN = "oc_oauth2_refresh_token";
328-
329-
/**
330-
* OAuth2 scope
331-
*/
332-
public static final String KEY_OAUTH2_SCOPE = "oc_oauth2_scope";
333-
334321
public static final int ACCOUNT_VERSION = 1;
335322
}
336323
}

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/authentication/oauth/OAuthConnectionBuilder.kt

Lines changed: 0 additions & 73 deletions
This file was deleted.

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/webdav/DavMethod.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,18 @@ public int execute() throws Exception {
7878
.build();
7979

8080
} else if (mResponse != null) {
81-
ResponseBody responseBody = ResponseBody.create(
82-
mResponse.body().contentType(),
83-
httpException.getResponseBody()
84-
);
85-
86-
mResponse = mResponse.newBuilder()
87-
.body(responseBody)
88-
.build();
81+
// The check below should be included in okhttp library, method ResponseBody.create(
82+
// TODO check most recent versions of okhttp to see if this is already fixed and try to update if so
83+
if (mResponse.body().contentType() != null) {
84+
ResponseBody responseBody = ResponseBody.create(
85+
mResponse.body().contentType(),
86+
httpException.getResponseBody()
87+
);
88+
89+
mResponse = mResponse.newBuilder()
90+
.body(responseBody)
91+
.build();
92+
}
8993
}
9094

9195
return httpException.getCode();

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/operations/RemoteOperationResult.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class RemoteOperationResult<T>
6666
private Exception mException = null;
6767
private ResultCode mCode = ResultCode.UNKNOWN_ERROR;
6868
private String mRedirectedLocation;
69-
private String mAuthenticate;
69+
private List<String> mAuthenticate = new ArrayList<>();
7070
private String mLastPermanentLocation = null;
7171
private T mData = null;
7272

@@ -253,7 +253,9 @@ public RemoteOperationResult(int httpCode, String httpPhrase, Headers headers) {
253253
continue;
254254
}
255255
if ("www-authenticate".equals(header.getKey().toLowerCase())) {
256-
mAuthenticate = header.getValue().get(0).toLowerCase();
256+
for (String value: header.getValue()) {
257+
mAuthenticate.add(value.toLowerCase());
258+
}
257259
}
258260
}
259261
}
@@ -494,7 +496,7 @@ public boolean isNonSecureRedirection() {
494496
return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://")));
495497
}
496498

497-
public String getAuthenticateHeaders() {
499+
public List<String> getAuthenticateHeaders() {
498500
return mAuthenticate;
499501
}
500502

0 commit comments

Comments
 (0)