(OFBIZ-10453)
There is a lot of repetitive code in ConfigXMLReader.
Using a functional interface as a parameter of a generic algorithm avoids those
repetitions.
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1834662 13f79535-47bb-0310-9956-ffa450edef68
OFBIZ-10438
The request-map element has a new method attribute to control a uri be called by GET or POST or all.
Thanks: Mathieu Lirzin for the contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1834389 13f79535-47bb-0310-9956-ffa450edef68
authentication
(OFBIZ-10307)
This reverts the work done previously for OFBIZ-9833 and OFBIZ-10206
Most parts of it will actually be reused later in a patch. By reverting it will
allow to provide a patch for others to review
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1833510 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10389)
Execution of the first visit events depends on the trackVisit function
In RequestHandler.java file
if (this.trackVisit(request) && session.getAttribute("_FIRST_VISIT_EVENTS_") == null) {
// execute first visit event
}
trackVisit function does not honor the default controller request
(in this case, cms) So, we should improve the code of trackVisit to honor
default controller request.
Thanks: Swapnil M Mane
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832944 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10420)
Prevents the session fixation by making Tomcat generate a new jsessionId
(ultimately put in cookie). Only do when really signing in to avoid unnecessary
calls
This improves the way it's done by using request.changeSessionId() instead of
creating a brand new session. So there is no possible side effects on client and
no need to set initial request info (using setInitialRequestInfo)
Thanks: Taher for asking about it
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832756 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10420)
Fixes a session fixation security issue discovered by a client with the security
audit tool "IBM Security AppScan Enterprise , Version : 9.0.3.7"
Prevents the session fixation by making Tomcat generate a new jsessionId
(ultimately put in cookie).
Only do when really signing in to avoid unnecessary calls
Though if the client has disabled the use of cookies, then a session will be
new on each request, not a good choice on client side!
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832662 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10410)
Instead of relying on manual synchronisation, use a concurrent map for caching
loaded classes.
Inline private `invoke` delegate which intent was fuzzy.
Spread arguments when calling `Method::invoke` and `Class::getMethod`.
jleroux: interesting, it's the 1st use in OFBiz of the "::" syntax for calling
methods
(cf. https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.13-500)
I note that the string "::" is used in many places as a separator, notably
in caches, as cache key separator but this should not be confusing.
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832199 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10369)
The events contained in the controller configuration for first-visit, pre-post processor and before-after login are executed in arbitrary order rather than the defined order.
If we define an event configuration as follow:
<after-login>
<event name=keepCartUpdated type=java path=org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents invoke=keepCartUpdated/>
<event name=restoreAutoSaveList type=java path=org.apache.ofbiz.order.shoppinglist.ShoppingListEvents invoke=restoreAutoSaveList/>
<event name=saveCartToAutoSaveList type=java path=org.apache.ofbiz.order.shoppinglist.ShoppingListEvents invoke=saveCartToAutoSaveList/>
</after-login>
We wait that OFBIz run keepCartUpdated, restoreAutoSaveList and after saveCartToAutoSaveList event but the HashMap who organise them return arbitrary order and can return saveCartToAutoSaveList, keepCartUpdated and restoreAutoSaveList. Convert the HashMap to LinkedHashMap help to keep the loaded order.
Thanks to Vikas Mayur for solve this issue
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1830303 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10369)
The events contained in the controller configuration for first-visit, pre-post processor and before-after login are executed in arbitrary order rather than the defined order.
If we define an event configuration as follow:
<after-login>
<event name=keepCartUpdated type=java path=org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents invoke=keepCartUpdated/>
<event name=restoreAutoSaveList type=java path=org.apache.ofbiz.order.shoppinglist.ShoppingListEvents invoke=restoreAutoSaveList/>
<event name=saveCartToAutoSaveList type=java path=org.apache.ofbiz.order.shoppinglist.ShoppingListEvents invoke=saveCartToAutoSaveList/>
</after-login>
We wait that OFBIz run keepCartUpdated, restoreAutoSaveList and after saveCartToAutoSaveList event but the HashMap who organise them return arbitrary order and can return saveCartToAutoSaveList, keepCartUpdated and restoreAutoSaveList. Convert the HashMap to LinkedHashMap help to keep the loaded order.
Thanks to Vikas Mayur for solve this issue
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1830301 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9833)
Removes the code I temporarily removed on trunk demo (controversial) to test my
changes
Also adds the LoginWorker.autoLoginSet()
This is just a commit to go ahead, later I will revert all related and provide
a patch for discussion at OFBIZ-9833.
I'll also certainly use Deepak's JWTManager.createJwt() instead of mine, it's
more general and I actually only need to pass the userLoginId. We have though
to discuss that anyway, I see some differences...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1826949 13f79535-47bb-0310-9956-ffa450edef68
(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
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1826938 13f79535-47bb-0310-9956-ffa450edef68
(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/trunk@1824803 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10206)
The version I committed so far in OFBIZ-9833 has a small security issue.
See the Jira description for all details
To test I have attached a OFBIZ-10206-external-server-test-example.patch to
the Jira
This removes the external-server-query property now useless
In ContextFilter the getHeader (wrapper) now uses an autoLoginCookie to get
the userLoginId passed in the JWT instead of externalServerUserLogin parameter.
A sourceServerWebappName parameter must be passed from the client request to
allow reading the autoLoginCookie.
This userLoginId is then retrieved on the target server from the JWT in the
externalServerLoginCheck which is simplified.
In LoginWorker
getAutoLoginCookieName() has now 2 versions to allow to pass a webappname
A new autoLogoutFromAllBackendSessions() method has been added but for now
commented out. Decommenting it out will be submitted as a patch in OFBIZ-4959.
Thanks: Leila Mekika for reporting the security issue directly to me
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1823324 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9833)
I just thought that for security it's best to have both the source and
target server using the use-external-server property.
Also default to N when requesting this property
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822882 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10167)
As reported by Deepak on dev ML the returned name should be a parameter and not
enforced to "Authorisation"
This removes a wrong comment (no functional change)
Thanks: Deepak for bug report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1821230 13f79535-47bb-0310-9956-ffa450edef68
Improve RequestHandler.makeLink code to manage url generation with surcharge the webapp path.
When a websiteId is present and it have a webappPatch define, use it on the link generation.
Example of use :
You have a httpd serveur that listen on *.mydomaine.com and define virtualHost myEcommerce.mydomaine.com and myCatalog.mydomaine.com
myEcommerce.mydomaine.com is a reverse proxy to myEcommerce.mydomaine.com/ecommerce
myCatalog.mydomaine.com is a reverse proxy to myEcommerce.mydomaine.com/catalog
Natively, all works fine with some parameters on web.xml and controller.xml but each link return are setted like that myEcommerce.mydomaine.com/ecommerce, called by apache httpd to ofbiz by myEcommerce.mydomaine.com/ecommerce/ecommerce and translate by ofbiz by ERROR ecommerce request-map not found
To solve the situation, I extended WebSite entity with attribute webappPath, init to / for websiteId ecommerce ofbiz instance and /ecommerce for other websiteId liked to other ofbiz instance (dev, back) without apache httpd with limited reverse-proxy.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818494 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10052)
This completes the work done so far by removing double check in cases not using
brackets, like
if (Debug.verboseOn())
if (Debug.verboseOn()) Debug.logVerbose()
Thanks: Michael for reporting this case I missed.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818445 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10052)
This completes r1818075, there were still few cases, a last regexp search is
never too much :)
Found 4 other loops with Strings concatenation, but who cares, it's only
verbose logging...
There should not be anymore...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818077 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9833)
Comment about production server
I thought it was obvious that you should not keep this file on a production
server after having changed the default value of
ExternalServerJwtMasterSecretKey
Moreover we recommend to have the value of ExternalServerJwtMasterSecretKey
dynamically generated during each build to increase security
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814402 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9833)
I have tested the Token Based Authentication between my local machine and the
trunk demo. It works as expected.
This completes the previous commit by:
adding a new externalServerLoginCheck pre processor
Documenting how to set the ExternalServerJwtMasterSecretKey in production
using sed and uuidgen
Adding documenting properties in security.properties, not set to be used OOTB
but ready to be set in production
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814363 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9833)
This works the same way than externalLoginKey but between 2 servers,
not 2 webapps on the same server.
The Single Sign On (SSO) is ensured by a JWT token, then all is handled as
normal by a session on the reached server. The servers may or may not share a
database but the loginUserIds on the 2 servers must be the same.
OOTB the JWT masterSecretKey is not properly initialised and can not be OOTB.
As we sign on on several servers, so have different sessions, we can't use the
externalLoginKey way to create the JWT masterSecretKey.
The best way to create the JWT masterSecretKey is to use a temporary way to load
in a static final key when compiling. This is simple and most secure.
One of the proposed way is to use sed and uuidgen to modify the masterSecretKey
value. The magic words here are TEMPORARY and FINAL!
I have not tested this between 2 servers yet, only locally where it works well.
I'll do after this commit between my local instance and the trunk demo.
Thanks: Nicolas for the sed ans uuidgen suggestion
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1813679 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9891)
This fixes a bug where the configuration attribute in the view-map
differs from what is read in the configuration handler.
Aditionally,
a new option "none" is introduced. If it is set, no X-Frame-Options
header will be set.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1813276 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-6766)
Adds a Content Security Policy
To not block anything for the moment I have committed a simple most restrictive
Content-Security-Policy-Report-Only header
Then we can look at the issues using browsers tools (there are so much)
The next step is to report the errors (when there will not be too much) in the
log using a report-uri
And ultimately to use OOTB the most simple and constraining policy, with
exceptions of course (as ever).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812720 13f79535-47bb-0310-9956-ffa450edef68