Skip to content

Commit

Permalink
Improved: Add session tracking mode and make cookie secure
Browse files Browse the repository at this point in the history
(OFBIZ-6655)

Programmatically replaces the web.xml <session-config> declarations and uses 
the @weblistener annotation to start the process. This avoid to duplicates 
things everywhere in web.xml files. Since the web.xml files have precedence 
on annotations, the setting can be easily overridden when necessary.

Now that we also use HTTPS in ecommerce the ecommerce session cookie is 
also secured.

I also noted that we had 8 weird <session-timeout> declarations:
    in solr component: <session-timeout>2</session-timeout>
    in themes: <session-timeout>1</session-timeout>

Also in Rainbowstone we lacked the <cookie-config> and <tracking-mode> 
declarations. I think it's not good.

I resolve these points by simply removing the <session-config> in web.xml files 
of themes and Solr.

Thanks: Pradhan Yash Sharma  for review

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/trunk@1811041 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
JacquesLeRoux committed Oct 4, 2017
1 parent e13f40b commit 3c70a28
Show file tree
Hide file tree
Showing 25 changed files with 7 additions and 203 deletions.
9 changes: 0 additions & 9 deletions assetmaint/webapp/assetmaint/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions assetmaint/webapp/ismgr/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,6 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions bi/webapp/bi/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions birt/webapp/accounting/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions birt/webapp/birt/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ under the License.
<url-pattern>/extract</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions birt/webapp/facility/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ under the License.
<url-pattern>/ShippingAPI.dll</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions birt/webapp/ordermgr/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ under the License.
<url-pattern>/products/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
7 changes: 0 additions & 7 deletions cmssite/webapp/cmssite/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ under the License.
<url-pattern>/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions ebay/webapp/ebay/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions ebaystore/webapp/ebaystore/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions ecommerce/webapp/ecommerce/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,6 @@ under the License.
<url-pattern>/products/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions ecommerce/webapp/ecomseo/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,6 @@ under the License.
<url-pattern>/products/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
7 changes: 7 additions & 0 deletions example/entitydef/entitymodel_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,11 @@ under the License.
<alias entity-alias="EX" name="total" field="exampleId" function="count-distinct"/>
<alias entity-alias="EX" name="exampleTypeId" group-by="true"/>
</view-entity>

<view-entity entity-name="ExampleTypeView" package-name="org.apache.ofbiz.example.example">
<member-entity entity-alias="EX" entity-name="Example"/>
<alias entity-alias="EX" name="exampleId" field="exampleId" />
<alias entity-alias="EX" name="exampleTypeId" group-by="true"/>
</view-entity>

</entitymodel>
8 changes: 0 additions & 8 deletions example/webapp/example/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions exampleext/webapp/exampleext/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions hhfacility/webapp/hhfacility/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions lucene/webapp/content/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions myportal/webapp/myportal/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions pricat/webapp/pricat/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions pricat/webapp/pricatdemo/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions projectmgr/webapp/projectmgr/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout> <!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions scrum/webapp/demotest/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ under the License.
<url-pattern>/control/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
Expand Down
8 changes: 0 additions & 8 deletions scrum/webapp/scrum/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ under the License.
</servlet>
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>

<session-config>
<session-timeout>60</session-timeout><!-- in minutes -->
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down
9 changes: 0 additions & 9 deletions solr/webapp/solr/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,6 @@
<url-pattern>/schema/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>2</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>

<mime-mapping>
<extension>.xsl</extension>
<!-- per http://www.w3.org/TR/2006/PR-xslt20-20061121/ -->
Expand Down
7 changes: 0 additions & 7 deletions webpos/webapp/webpos/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@
<servlet-name>CatalogUrlServlet</servlet-name>
<url-pattern>/products/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
Expand Down

0 comments on commit 3c70a28

Please sign in to comment.