first commit
This commit is contained in:
81
jeeutil/pom.xml
Normal file
81
jeeutil/pom.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>shared</artifactId>
|
||||
<groupId>de.muehlencord</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>de.muehlencord.app</groupId>
|
||||
<artifactId>shared-jeeutil</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>ejb</packaging>
|
||||
|
||||
<name>shared-jeeutil</name>
|
||||
|
||||
<properties>
|
||||
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>6.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<compilerArguments>
|
||||
<endorseddirs>${endorsed.dir}</endorseddirs>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-ejb-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<ejbVersion>3.1</ejbVersion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${endorsed.dir}</outputDirectory>
|
||||
<silent>true</silent>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-endorsed-api</artifactId>
|
||||
<version>6.0</version>
|
||||
<type>jar</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,58 @@
|
||||
package de.muehlencord.app.sharedjeeutil;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* Filter to suppress ClickJacking by adding X-FRAME-OPTIONS to header.
|
||||
* see https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet for details
|
||||
*
|
||||
* @author joern@muehlencord.de
|
||||
*/
|
||||
public class ClickJackFIlter implements Filter {
|
||||
|
||||
/** mode to use */
|
||||
private String mode = "DENY";
|
||||
|
||||
/**
|
||||
* inits the filter. Checks if a parameter "mode" is available in parameter map tp use instead default "DENY"
|
||||
*
|
||||
* @param filterConfig
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
String configMode = filterConfig.getInitParameter("mode");
|
||||
if (configMode != null) {
|
||||
mode = configMode;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add X-FRAME-OPTIONS response header to tell IE8 (and any other browsers who decide to implement) not to display this content in a frame. For details,
|
||||
* please refer to http://blogs.msdn.com/sdl/archive/2009/02/05/clickjacking-defense-in-ie8.aspx.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param chain
|
||||
* @throws IOException
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
res.addHeader("X-FRAME-OPTIONS", mode);
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// nothing todo here
|
||||
}
|
||||
}
|
||||
2
jeeutil/src/main/resources/META-INF/MANIFEST.MF
Normal file
2
jeeutil/src/main/resources/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
||||
Reference in New Issue
Block a user