mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Changes to invalidate SAML credentials properly
This commit is contained in:
parent
12d04bb63c
commit
75821de7a3
@ -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
|
||||||
@ -229,6 +229,8 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
|
|
||||||
status = super.executeMethod(method);
|
status = super.executeMethod(method);
|
||||||
|
|
||||||
|
checkFirstRedirection(method);
|
||||||
|
|
||||||
if (mFollowRedirects) {
|
if (mFollowRedirects) {
|
||||||
status = followRedirection(method).getLastStatus();
|
status = followRedirection(method).getLastStatus();
|
||||||
}
|
}
|
||||||
@ -247,6 +249,18 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkFirstRedirection(HttpMethod method) {
|
||||||
|
Header[] httpHeaders = method.getResponseHeaders();
|
||||||
|
|
||||||
|
for (Header httpHeader : httpHeaders) {
|
||||||
|
|
||||||
|
if ("location".equals(httpHeader.getName().toLowerCase())) {
|
||||||
|
mRedirectedLocation = httpHeader.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix for https://github.com/owncloud/android/issues/1847#issuecomment-267558274
|
* Fix for https://github.com/owncloud/android/issues/1847#issuecomment-267558274
|
||||||
*
|
*
|
||||||
@ -290,13 +304,12 @@ public class OwnCloudClient extends HttpClient {
|
|||||||
location = method.getResponseHeader("location");
|
location = method.getResponseHeader("location");
|
||||||
}
|
}
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
Log_OC.d(TAG + " #" + mInstanceNumber,
|
|
||||||
"Location to redirect: " + location.getValue());
|
|
||||||
|
|
||||||
String locationStr = location.getValue();
|
String locationStr = location.getValue();
|
||||||
result.addLocation(locationStr);
|
|
||||||
|
|
||||||
mRedirectedLocation = locationStr;
|
Log_OC.d(TAG + " #" + mInstanceNumber,
|
||||||
|
"Location to redirect: " + locationStr);
|
||||||
|
|
||||||
|
result.addLocation(locationStr);
|
||||||
|
|
||||||
// Release the connection to avoid reach the max number of connections per host
|
// Release the connection to avoid reach the max number of connections per host
|
||||||
// due to it will be set a different url
|
// due to it will be set a different url
|
||||||
|
@ -313,15 +313,13 @@ public class RemoteOperationResult implements Serializable {
|
|||||||
public RemoteOperationResult(boolean success, int httpCode, String httpPhrase, Header[] httpHeaders) {
|
public RemoteOperationResult(boolean success, int httpCode, String httpPhrase, Header[] httpHeaders) {
|
||||||
this(success, httpCode, httpPhrase);
|
this(success, httpCode, httpPhrase);
|
||||||
if (httpHeaders != null) {
|
if (httpHeaders != null) {
|
||||||
Header current;
|
|
||||||
for (Header httpHeader : httpHeaders) {
|
for (Header httpHeader : httpHeaders) {
|
||||||
current = httpHeader;
|
if ("location".equals(httpHeader.getName().toLowerCase())) {
|
||||||
if ("location".equals(current.getName().toLowerCase())) {
|
mRedirectedLocation = httpHeader.getValue();
|
||||||
mRedirectedLocation = current.getValue();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ("www-authenticate".equals(current.getName().toLowerCase())) {
|
if ("www-authenticate".equals(httpHeader.getName().toLowerCase())) {
|
||||||
mAuthenticate.add(current.getValue().toLowerCase());
|
mAuthenticate.add(httpHeader.getValue().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user