Unverified Commit 36f6db3d authored by Lucio Maciel's avatar Lucio Maciel Committed by GitHub

Merge pull request #1344 from RocketChat/improvement/web-view-cache

[IMPROVEMENT] Removes web view cookies for OAuth and SSO.
parents 8ea0a6a1 ca906535
...@@ -6,6 +6,7 @@ import android.content.Context ...@@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.webkit.CookieManager
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import androidx.core.net.toUri import androidx.core.net.toUri
...@@ -39,12 +40,15 @@ class OauthWebViewActivity : AppCompatActivity() { ...@@ -39,12 +40,15 @@ class OauthWebViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_view) setContentView(R.layout.activity_web_view)
webPageUrl = intent.getStringExtra(INTENT_WEB_PAGE_URL) webPageUrl = intent.getStringExtra(INTENT_WEB_PAGE_URL)
requireNotNull(webPageUrl) { "no web_page_url provided in Intent extras" } requireNotNull(webPageUrl) { "no web_page_url provided in Intent extras" }
state = intent.getStringExtra(INTENT_STATE) state = intent.getStringExtra(INTENT_STATE)
requireNotNull(state) { "no state provided in Intent extras" } requireNotNull(state) { "no state provided in Intent extras" }
// Ensures that the cookies is always removed when opening the webview.
CookieManager.getInstance().removeAllCookies(null)
setupToolbar() setupToolbar()
} }
......
...@@ -7,6 +7,7 @@ import android.content.Intent ...@@ -7,6 +7,7 @@ import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.os.Bundle import android.os.Bundle
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.webkit.CookieManager
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import chat.rocket.android.R import chat.rocket.android.R
...@@ -41,6 +42,8 @@ class SsoWebViewActivity : AppCompatActivity() { ...@@ -41,6 +42,8 @@ class SsoWebViewActivity : AppCompatActivity() {
casToken = intent.getStringExtra(INTENT_SSO_TOKEN) casToken = intent.getStringExtra(INTENT_SSO_TOKEN)
requireNotNull(casToken) { "no cas_token provided in Intent extras" } requireNotNull(casToken) { "no cas_token provided in Intent extras" }
// Ensures that the cookies is always removed when opening the webview.
CookieManager.getInstance().removeAllCookies(null)
setupToolbar() setupToolbar()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment