From e3ddf17253f248380646b8c161a040a2d422e78a Mon Sep 17 00:00:00 2001 From: Jordan Marshall Date: Thu, 27 Jun 2019 15:57:49 -0600 Subject: [PATCH] [Teacher][R-1.8.1] Siteadmin login fix (#132) --- .../login/activities/BaseLoginSignInActivity.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginSignInActivity.java b/libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginSignInActivity.java index ce4f89a5a1..8a0435169f 100644 --- a/libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginSignInActivity.java +++ b/libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginSignInActivity.java @@ -410,13 +410,17 @@ final protected void loadAuthenticationUrl(final String apiProtocol, final Strin mAuthenticationURL += "&canvas_login=1"; } else if (mCanvasLogin == MASQUERADE_FLOW) { // canvas_sa_delegated=1 identifies that we want to masquerade - final String cookie = "canvas_sa_delegated=1;domain=.instructure.com;path=/;"; CookieManager cookieManager = CookieManager.getInstance(); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cookieManager.setAcceptThirdPartyCookies(mWebView, true); } - cookieManager.setCookie(apiProtocol + "://" + domain, cookie); - cookieManager.setCookie(".instructure.com", cookie); + if (domain.contains(".instructure.com")) { + String cookie = "canvas_sa_delegated=1;domain=.instructure.com;path=/;"; + cookieManager.setCookie(apiProtocol + "://" + domain, cookie); + cookieManager.setCookie(".instructure.com", cookie); + } else { + cookieManager.setCookie(domain, "canvas_sa_delegated=1"); + } } mWebView.loadUrl(mAuthenticationURL, getHeaders());