mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Merge pull request #1041 from nextcloud/authInNC12
Multiple auth headers in NC12
This commit is contained in:
commit
343b65645c
2 changed files with 9 additions and 4 deletions
|
@ -178,7 +178,7 @@ dependencies {
|
||||||
compile name: 'touch-image-view'
|
compile name: 'touch-image-view'
|
||||||
compile 'com.android.support:multidex:1.0.1'
|
compile 'com.android.support:multidex:1.0.1'
|
||||||
|
|
||||||
compile 'com.github.nextcloud:android-library:1.0.18'
|
compile 'com.github.nextcloud:android-library:1.0.20'
|
||||||
compile "com.android.support:support-v4:${supportLibraryVersion}"
|
compile "com.android.support:support-v4:${supportLibraryVersion}"
|
||||||
compile "com.android.support:design:${supportLibraryVersion}"
|
compile "com.android.support:design:${supportLibraryVersion}"
|
||||||
compile 'com.jakewharton:disklrucache:2.0.2'
|
compile 'com.jakewharton:disklrucache:2.0.2'
|
||||||
|
|
|
@ -97,9 +97,14 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
|
||||||
|
|
||||||
// analyze response
|
// analyze response
|
||||||
if (result.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) {
|
if (result.getHttpCode() == HttpStatus.SC_UNAUTHORIZED) {
|
||||||
String authRequest = ((result.getAuthenticateHeader()).trim()).toLowerCase();
|
ArrayList<String> authHeaders = result.getAuthenticateHeaders();
|
||||||
if (authRequest.startsWith("basic") || authRequest.startsWith("bearer")) {
|
|
||||||
authMethod = AuthenticationMethod.BASIC_HTTP_AUTH;
|
for (String header : authHeaders) {
|
||||||
|
// currently we only support basic auth
|
||||||
|
if (header.toLowerCase().startsWith("basic")) {
|
||||||
|
authMethod = AuthenticationMethod.BASIC_HTTP_AUTH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// else - fall back to UNKNOWN
|
// else - fall back to UNKNOWN
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue