mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	update session from APM while running the app
This commit is contained in:
		
							parent
							
								
									b2f6d7f3b1
								
							
						
					
					
						commit
						cfd69987e9
					
				| @ -7,6 +7,8 @@ dependencies { | ||||
|     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" | ||||
|     api 'com.gitlab.ownclouders:dav4android:oc_support_2.1.5' | ||||
|     api 'com.github.AppDevNext.Logcat:LogcatCore:2.2.2' | ||||
|     debugImplementation 'com.facebook.stetho:stetho:1.5.1' | ||||
|     debugImplementation 'com.facebook.stetho:stetho-okhttp3:1.5.1' | ||||
| 
 | ||||
|     // Moshi | ||||
|     implementation("com.squareup.moshi:moshi-kotlin:$moshiVersion") { | ||||
|  | ||||
| @ -21,7 +21,7 @@ class ConnectionValidator ( | ||||
|             var validationRetryCount = 0 | ||||
|             val client = OwnCloudClient(baseClient.baseUri, null, false) | ||||
|             if (clearCookiesOnValidation) { | ||||
|                 client.clearCookies() | ||||
|                 client.clearCookies(); | ||||
|             } else { | ||||
|                 client.cookiesForBaseUri = baseClient.cookiesForBaseUri | ||||
|             } | ||||
| @ -84,7 +84,7 @@ class ConnectionValidator ( | ||||
|     } | ||||
| 
 | ||||
|     private fun triggerAuthRefresh(): OwnCloudCredentials { | ||||
|         //TODO: Implement me | ||||
|         Timber.d("!!!!!!!!!!!!!!!!!!!!!!!!!!!! need to reauthenticate !!!!!!!!!!!!!!!!!!!!!!!!!!") | ||||
|         return OwnCloudCredentialsFactory.getAnonymousCredentials() | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -340,10 +340,6 @@ public class OwnCloudClient extends HttpClient { | ||||
|                     HttpUrl.parse(mBaseUri.toString())); | ||||
|     } | ||||
| 
 | ||||
|     public void clearCookies() { | ||||
|         setCookiesForBaseUri(new ArrayList<>()); | ||||
|     } | ||||
| 
 | ||||
|     public OwnCloudVersion getOwnCloudVersion() { | ||||
|         return mVersion; | ||||
|     } | ||||
|  | ||||
| @ -28,7 +28,7 @@ import okhttp3.CookieJar | ||||
| import okhttp3.HttpUrl | ||||
| 
 | ||||
| class CookieJarImpl( | ||||
|     private val sCookieStore: HashMap<String, List<Cookie>> | ||||
|     private val cookieStore: HashMap<String, List<Cookie>> | ||||
| ) : CookieJar { | ||||
| 
 | ||||
|     fun containsCookieWithName(cookies: List<Cookie>, name: String): Boolean { | ||||
| @ -52,12 +52,11 @@ class CookieJarImpl( | ||||
| 
 | ||||
|     override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) { | ||||
|         // Avoid duplicated cookies but update | ||||
|         val currentCookies: List<Cookie> = sCookieStore[url.host] ?: ArrayList() | ||||
|         val currentCookies: List<Cookie> = cookieStore[url.host] ?: ArrayList() | ||||
|         val updatedCookies: List<Cookie> = getUpdatedCookies(currentCookies, cookies) | ||||
|         sCookieStore[url.host] = updatedCookies | ||||
|         cookieStore[url.host] = updatedCookies | ||||
|     } | ||||
| 
 | ||||
|     override fun loadForRequest(url: HttpUrl) = | ||||
|         sCookieStore[url.host] ?: ArrayList() | ||||
| 
 | ||||
|         cookieStore[url.host] ?: ArrayList() | ||||
| } | ||||
| @ -26,6 +26,7 @@ package com.owncloud.android.lib.common.http; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| 
 | ||||
| import com.facebook.stetho.okhttp3.StethoInterceptor; | ||||
| import com.owncloud.android.lib.common.network.AdvancedX509TrustManager; | ||||
| import com.owncloud.android.lib.common.network.NetworkUtils; | ||||
| import okhttp3.Cookie; | ||||
| @ -139,4 +140,8 @@ public class HttpClient { | ||||
|     public static void setContext(Context context) { | ||||
|         sContext = context; | ||||
|     } | ||||
| 
 | ||||
|     public void clearCookies() { | ||||
|         sCookieStore.clear(); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user