commit
3b58b515ce
|
@ -0,0 +1,2 @@
|
||||||
|
### Relevant Articles:
|
||||||
|
- [Securing Java EE with Spring Security](http://www.baeldung.com/java-ee-spring-security)
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?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>
|
||||||
|
<artifactId>jee-7-security</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>jee-7-security</name>
|
||||||
|
<description>JavaEE 7 Spring Security Application</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-modules</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
<version>${javaee_api.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.faces</groupId>
|
||||||
|
<artifactId>jsf-api</artifactId>
|
||||||
|
<version>${com.sun.faces.jsf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.faces</groupId>
|
||||||
|
<artifactId>jsf-impl</artifactId>
|
||||||
|
<version>${com.sun.faces.jsf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>jstl</artifactId>
|
||||||
|
<version>${jstl.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>${javax.servlet-api.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet.jsp</groupId>
|
||||||
|
<artifactId>jsp-api</artifactId>
|
||||||
|
<version>${jsp-api.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>taglibs</groupId>
|
||||||
|
<artifactId>standard</artifactId>
|
||||||
|
<version>${taglibs.standard.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.mvc</groupId>
|
||||||
|
<artifactId>javax.mvc-api</artifactId>
|
||||||
|
<version>1.0-pr</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
<version>${org.springframework.security.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
<version>${org.springframework.security.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-taglibs</artifactId>
|
||||||
|
<version>${org.springframework.security.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>${maven-war-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<warSourceDirectory>src/main/webapp</warSourceDirectory>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<javaee_api.version>7.0</javaee_api.version>
|
||||||
|
<com.sun.faces.jsf.version>2.2.14</com.sun.faces.jsf.version>
|
||||||
|
<jsp-api.version>2.2</jsp-api.version>
|
||||||
|
<taglibs.standard.version>1.1.2</taglibs.standard.version>
|
||||||
|
<org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.springSecurity;
|
package com.baeldung.springsecurity;
|
||||||
|
|
||||||
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
|
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.springSecurity;
|
package com.baeldung.springsecurity;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.springSecurity.controller;
|
package com.baeldung.springsecurity.controller;
|
||||||
|
|
||||||
import javax.mvc.annotation.Controller;
|
import javax.mvc.annotation.Controller;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.springSecurity.controller;
|
package com.baeldung.springsecurity.controller;
|
||||||
|
|
||||||
import javax.mvc.annotation.Controller;
|
import javax.mvc.annotation.Controller;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="DEBUG">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faces-config
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||||
|
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
|
||||||
|
version="2.0">
|
||||||
|
</faces-config>
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
|
version="3.0">
|
||||||
|
<!-- The bare minimum needed for JSF 2.2 is a servlet 2.5 or later
|
||||||
|
declaration (this uses 3.0) and the mapping for the FacesServlet.
|
||||||
|
Setting PROJECT_STAGE to Development is highly recommended
|
||||||
|
during initial development so that you get more helpful
|
||||||
|
error messages. Whether you want server-side state saving
|
||||||
|
(default) or client-side is a more complicated question:
|
||||||
|
client-side uses more bandwidth but fewer server resources.
|
||||||
|
Client-side also helps to avoid the dreaded view expired exceptions.
|
||||||
|
|
||||||
|
From JSF 2 and PrimeFaces tutorial
|
||||||
|
at http://www.coreservlets.com/JSF-Tutorial/jsf2/
|
||||||
|
-->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>Faces Servlet</servlet-name>
|
||||||
|
<url-pattern>*.jsf</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<context-param>
|
||||||
|
<param-name>javax.faces.PROJECT_STAGE</param-name>
|
||||||
|
<param-value>Development</param-value>
|
||||||
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<description>State saving method: 'client' or 'server' (default). See JSF Specification section 2.5.2</description>
|
||||||
|
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
||||||
|
<param-value>client</param-value>
|
||||||
|
</context-param>
|
||||||
|
<!-- If you go to http://host/project/ (with no file name), it will
|
||||||
|
try index.jsf first, welcome.jsf next, and so forth.
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- UNCOMMENT THE FOLLOWING SECTION FOR SPRING SECURITY XML CONFIGURATION-->
|
||||||
|
|
||||||
|
<!--<context-param>-->
|
||||||
|
<!--<param-name>contextConfigLocation</param-name>-->
|
||||||
|
<!--<param-value>-->
|
||||||
|
<!--/WEB-INF/spring/*.xml-->
|
||||||
|
<!--</param-value>-->
|
||||||
|
<!--</context-param>-->
|
||||||
|
|
||||||
|
<!--<filter>-->
|
||||||
|
<!--<filter-name>springSecurityFilterChain</filter-name>-->
|
||||||
|
<!--<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>-->
|
||||||
|
<!--</filter>-->
|
||||||
|
|
||||||
|
<!--<filter-mapping>-->
|
||||||
|
<!--<filter-name>springSecurityFilterChain</filter-name>-->
|
||||||
|
<!--<url-pattern>/*</url-pattern>-->
|
||||||
|
<!--</filter-mapping>-->
|
||||||
|
|
||||||
|
<!--<listener>-->
|
||||||
|
<!--<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>-->
|
||||||
|
<!--</listener>-->
|
||||||
|
|
||||||
|
<!-- END SPRING SECURITY XML CONFIGURATION-->
|
||||||
|
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>index.jsf</welcome-file>
|
||||||
|
<welcome-file>welcome.jsf</welcome-file>
|
||||||
|
<welcome-file>index.html</welcome-file>
|
||||||
|
<welcome-file>index.jsp</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
</web-app>
|
|
@ -5,5 +5,3 @@
|
||||||
- [Introduction to JAX-WS](http://www.baeldung.com/jax-ws)
|
- [Introduction to JAX-WS](http://www.baeldung.com/jax-ws)
|
||||||
- [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations)
|
- [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations)
|
||||||
- [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian)
|
- [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian)
|
||||||
- [Securing Java EE with Spring Security](http://www.baeldung.com/java-ee-spring-security)
|
|
||||||
- [A Guide to Java EE Web-Related Annotations](https://www.baeldung.com/javaee-web-annotations)
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.baeldung.springSecurity;
|
|
||||||
|
|
||||||
import javax.ws.rs.ApplicationPath;
|
|
||||||
import javax.ws.rs.core.Application;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Application class required by JAX-RS. If you don't want to have any
|
|
||||||
* prefix in the URL, you can set the application path to "/".
|
|
||||||
*/
|
|
||||||
@ApplicationPath("/")
|
|
||||||
public class ApplicationConfig extends Application {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
|
version="3.0">
|
||||||
<!-- The bare minimum needed for JSF 2.2 is a servlet 2.5 or later
|
<!-- The bare minimum needed for JSF 2.2 is a servlet 2.5 or later
|
||||||
declaration (this uses 3.0) and the mapping for the FacesServlet.
|
declaration (this uses 3.0) and the mapping for the FacesServlet.
|
||||||
Setting PROJECT_STAGE to Development is highly recommended
|
Setting PROJECT_STAGE to Development is highly recommended
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -399,6 +399,7 @@
|
||||||
<module>javafx</module>
|
<module>javafx</module>
|
||||||
<module>jgroups</module>
|
<module>jgroups</module>
|
||||||
<module>jee-7</module>
|
<module>jee-7</module>
|
||||||
|
<module>jee-7-security</module>
|
||||||
<module>jhipster</module>
|
<module>jhipster</module>
|
||||||
<module>jjwt</module>
|
<module>jjwt</module>
|
||||||
<module>jsf</module>
|
<module>jsf</module>
|
||||||
|
@ -1302,6 +1303,7 @@
|
||||||
<module>javafx</module>
|
<module>javafx</module>
|
||||||
<module>jgroups</module>
|
<module>jgroups</module>
|
||||||
<module>jee-7</module>
|
<module>jee-7</module>
|
||||||
|
<module>jee-7-security</module>
|
||||||
<module>jjwt</module>
|
<module>jjwt</module>
|
||||||
<module>jsf</module>
|
<module>jsf</module>
|
||||||
<module>json-path</module>
|
<module>json-path</module>
|
||||||
|
|
Loading…
Reference in New Issue