svn commit: r1826938 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1826938 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java

jleroux@apache.org
Author: jleroux
Date: Fri Mar 16 09:35:06 2018
New Revision: 1826938

URL: http://svn.apache.org/viewvc?rev=1826938&view=rev
Log:
Fixed: Logout do not remove autoLogin
(OFBIZ-4959)

I used the only available (and I must say confusing) WebappInfo.getName() when
I needed the webAppName not the WebappInfoName. So this put in a new
WebappInfo.getMountPoint() and use it in getWebappInfo

Also use LoginWorker.autoLoginSet() in different places where I missed it. In
other words all autoUserLogin coockies are deleted on login and logout, and
an autoUserLogin cookie is created when going locally from a webapp to another,
with checkExternalLoginKey

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java?rev=1826938&r1=1826937&r2=1826938&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java Fri Mar 16 09:35:06 2018
@@ -316,7 +316,8 @@ public final class ComponentConfig {
         WebappInfo webappInfo = null;
         List<WebappInfo> webappsInfo = getAppBarWebInfos(serverName);
         for(WebappInfo currApp : webappsInfo) {
-            if (webAppName.equals(currApp.getName())) {
+            String currWebAppName = currApp.getMountPoint().replace("/", "").replace("*", "");
+            if (webAppName.equals(currWebAppName)) {
                 webappInfo = currApp;
                 break;
             }
@@ -944,6 +945,10 @@ public final class ComponentConfig {
             return name;
         }
 
+        public String getMountPoint() {
+            return mountPoint;
+        }
+
         public String getTitle() {
             return title;
         }

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java?rev=1826938&r1=1826937&r2=1826938&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java Fri Mar 16 09:35:06 2018
@@ -157,7 +157,8 @@ public class ExternalLoginKeysManager {
             GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin");
             if (currentUserLogin != null) {
                 if (currentUserLogin.getString("userLoginId").equals(userLogin.getString("userLoginId"))) {
-                    // is the same user, just carry on...
+                    // same user, just make sure the autoUserLogin is set to the same and that the client cookie has the correct userLoginId
+                    LoginWorker.autoLoginSet(request, response);
                     return "success";
                 }
 
@@ -171,6 +172,9 @@ public class ExternalLoginKeysManager {
             Debug.logWarning("Could not find userLogin for external login key: " + externalKey, module);
         }
 
+        // make sure the autoUserLogin is set to the same and that the client cookie has the correct userLoginId
+        LoginWorker.autoLoginSet(request, response);
+        
         return "success";
     }