Skip to content

Commit

Permalink
Created proper multi-module maven structure:
Browse files Browse the repository at this point in the history
* unified naming conventions for sub-modules
* added possibility to deploy the test JSP application from maven using a profile
* removed unnecessary files (the project should be IDE agnostic)

Changed Language Level to Java 1.8

Fixes issue #128
  • Loading branch information
forgedhallpass committed Jul 30, 2020
1 parent db16d99 commit bb3421e
Show file tree
Hide file tree
Showing 45 changed files with 436 additions and 552 deletions.
24 changes: 0 additions & 24 deletions JavaServerFaces/src/main/java/com/mkyong/common/HelloBean.java

This file was deleted.

27 changes: 0 additions & 27 deletions csrfguard-test/.classpath

This file was deleted.

2 changes: 0 additions & 2 deletions csrfguard-test/.gitignore

This file was deleted.

42 changes: 0 additions & 42 deletions csrfguard-test/.project

This file was deleted.

13 changes: 0 additions & 13 deletions csrfguard-test/.settings/.jsdtscope

This file was deleted.

3 changes: 0 additions & 3 deletions csrfguard-test/.settings/org.eclipse.core.resources.prefs

This file was deleted.

8 changes: 0 additions & 8 deletions csrfguard-test/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions csrfguard-test/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

12 changes: 0 additions & 12 deletions csrfguard-test/.settings/org.eclipse.wst.common.component

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions csrfguard-test/.settings/org.eclipse.wst.validation.prefs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,71 +1,82 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong.common</groupId>
<artifactId>JavaServerFaces</artifactId>

<parent>
<groupId>org.owasp</groupId>
<artifactId>csrfguard-test</artifactId>
<version>3.1.0-SNAPSHOT</version>
</parent>

<artifactId>csrfguard-test-jsf</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>JavaServerFaces Maven Webapp</name>
<url>http://maven.apache.org</url>

<name>OWASP CsrfGuard JSF Test WebApp</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xhtml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.owasp</groupId>
<artifactId>csrfguard</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.owasp</groupId>
<artifactId>csrfguard</artifactId>
<version>3.1.0</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<build>
<finalName>JavaServerFaces</finalName>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* The OWASP CSRFGuard Project, BSD License
* Eric Sheridan (eric@infraredsecurity.com), Copyright (c) 2011
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of OWASP nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.owasp.csrfguard.test;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.io.Serializable;

@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {

private static final long serialVersionUID = 1L;

private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>



<!-- Map these files with JSF -->
<servlet-mapping>
Expand Down Expand Up @@ -53,7 +51,6 @@
<url-pattern>/*</url-pattern>
</filter-mapping>


<listener>
<listener-class>org.owasp.csrfguard.CsrfGuardServletContextListener</listener-class>
</listener>
Expand All @@ -69,7 +66,6 @@
<param-value>true</param-value>
</context-param>


<servlet>
<servlet-name>JavaScriptServlet</servlet-name>
<servlet-class>org.owasp.csrfguard.servlet.JavaScriptServlet</servlet-class>
Expand All @@ -79,5 +75,4 @@
<servlet-name>JavaScriptServlet</servlet-name>
<url-pattern>/JavaScriptServlet</url-pattern>
</servlet-mapping>

</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
<h:commandButton value="Welcome Me" action="welcome"></h:commandButton>
</h:form>
</h:body>
<script src="/JavaServerFaces/JavaScriptServlet"></script>
<script src="/${project.build.finalName}/JavaScriptServlet"></script>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
<h3>JSF 2.0 Hello World Example - welcome.xhtml</h3>
<h4>Welcome #{helloBean.name}</h4>
</h:body>
<script src="/JavaServerFaces/JavaScriptServlet"></script>
<script src="/${project.build.finalName}/JavaScriptServlet"></script>
</html>
Loading

0 comments on commit bb3421e

Please sign in to comment.