mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	make automatic login with session timeout on saml work
This commit is contained in:
		
							parent
							
								
									f1c6726d30
								
							
						
					
					
						commit
						bd5dc20842
					
				| @ -1 +1 @@ | ||||
| Subproject commit b20c44c63f45355599d4bfaf00042964b9e6cafa | ||||
| Subproject commit 1108048f1a2ff12103cdf6a95307a314d621c088 | ||||
| @ -46,6 +46,7 @@ import java.io.InputStream; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import at.bitfire.dav4android.exception.HttpException; | ||||
| import at.bitfire.dav4android.exception.RedirectException; | ||||
| import okhttp3.Cookie; | ||||
| import okhttp3.Headers; | ||||
| import okhttp3.HttpUrl; | ||||
| @ -131,16 +132,21 @@ public class OwnCloudClient extends HttpClient { | ||||
| 
 | ||||
|         boolean repeatWithFreshCredentials; | ||||
|         int repeatCounter = 0; | ||||
|         int status; | ||||
|         int status = -1; | ||||
| 
 | ||||
|         do { | ||||
|             try { | ||||
|                 status = method.execute(); | ||||
|             } catch (HttpException e) { | ||||
|                 if(e.getMessage().contains(Integer.toString(HttpConstants.HTTP_MOVED_TEMPORARILY))) { | ||||
|                 checkFirstRedirection(method); | ||||
|                 if(mFollowRedirects) { | ||||
|                     status = followRedirection(method).getLastStatus(); | ||||
|                 } | ||||
|             } catch (RedirectException e) { | ||||
|                 // redirect must be handled twice. Once for dav4droid and once okhttp redirect errors | ||||
|                 status = e.getStatus(); | ||||
|                 mRedirectedLocation = e.getRedirectLocation(); | ||||
|                 if(mFollowRedirects) { | ||||
|                     status = followRedirection(method).getLastStatus(); | ||||
|                 } else { | ||||
|                     throw e; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
| @ -153,6 +159,14 @@ public class OwnCloudClient extends HttpClient { | ||||
|         return status; | ||||
|     } | ||||
| 
 | ||||
|     private void checkFirstRedirection(HttpBaseMethod method) { | ||||
| 
 | ||||
|         final String location = method.getResponseHeader("location"); | ||||
|         if(location != null && !location.isEmpty()) { | ||||
|             mRedirectedLocation = location; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private int executeRedirectedHttpMethod (HttpBaseMethod method) throws Exception { | ||||
|         boolean repeatWithFreshCredentials; | ||||
|         int repeatCounter = 0; | ||||
|  | ||||
| @ -47,6 +47,7 @@ public abstract class DavMethod extends HttpBaseMethod { | ||||
|                 mOkHttpClient, | ||||
|                 httpUrl | ||||
|         ); | ||||
|         mDavResource.setFollowRedirects(false); | ||||
|     } | ||||
| 
 | ||||
|     public DavResource getDavResource() { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user