"Applied fix from trunk for revision: 1824803 "

------------------------------------------------------------------------
r1824803 | jleroux | 2018-02-19 20:23:36 +0100 (lun., 19 févr. 2018) | 18 lines

Fixed: Logout do not remove autoLogin
(OFBIZ-4959)

Logout method do not disable autoLogin functionality. 
Instead of that it just initializes autoLogin in session and request.

jleroux: this was also needed by OFBIZ-10206 "Security issue in Token Based 
Authentication". 
This creates a keep-autologin-cookie boolean attribute in the webapp element of 
the  ofbiz-component.xml, documented in ofbiz-component.xsd
This attribute is used to get the value from the ofbiz-component.xml files in a
new autoLogoutCleanCookies() LoginWorker method. This method is used not only 
when login out but also when login in. This to be sure that in every cases the 
cookies related to the webapps are removed.
For now only the ecommerce, ecomseo et webpos webapps are keeping and using 
their autologin cookies

Thanks: Roberto Benítez Monje for report and Taher for discussion and suggestion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1824804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2018-02-19 19:24:14 +00:00
parent 904bf98788
commit d0735d2181
3 changed files with 50 additions and 13 deletions
@@ -311,6 +311,20 @@ public final class ComponentConfig {
}
return info;
}
public static WebappInfo getWebappInfo(String serverName, String webAppName) {
WebappInfo webappInfo = null;
List<WebappInfo> webappsInfo = getAppBarWebInfos(serverName);
for(WebappInfo currApp : webappsInfo) {
if (webAppName.equals(currApp.getName())) {
webappInfo = currApp;
break;
}
}
return webappInfo;
}
public static boolean isFileResourceLoader(String componentName, String resourceLoaderName) throws ComponentException {
ComponentConfig cc = getComponentConfig(componentName);
@@ -812,6 +826,7 @@ public final class ComponentConfig {
// CatalinaContainer modifies this field.
private volatile boolean appBarDisplay;
private final String accessPermission;
private final boolean keepAutologinCookie;
private WebappInfo(ComponentConfig componentConfig, Element element) {
this.componentConfig = componentConfig;
@@ -851,6 +866,7 @@ public final class ComponentConfig {
this.appBarDisplay = !"false".equals(element.getAttribute("app-bar-display"));
this.privileged = !"false".equals(element.getAttribute("privileged"));
this.accessPermission = element.getAttribute("access-permission");
this.keepAutologinCookie = !"false".equals(element.getAttribute("keep-autologin-cookie"));
String basePermStr = element.getAttribute("base-permission");
if (!basePermStr.isEmpty()) {
this.basePermission = basePermStr.split(",");
@@ -936,6 +952,10 @@ public final class ComponentConfig {
return virtualHosts;
}
public boolean getKeepAutologinCookie() {
return keepAutologinCookie;
}
public synchronized void setAppBarDisplay(boolean appBarDisplay) {
this.appBarDisplay = appBarDisplay;
}