diff --git a/spring-security-client/spring-security-jsp-authentication/.classpath b/spring-security-client/spring-security-jsp-authentication/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-jsp-authentication/.project b/spring-security-client/spring-security-jsp-authentication/.project
new file mode 100644
index 0000000000..6fbbb8518e
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-jsp-authenticate
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-jsp-authentication/pom.xml b/spring-security-client/spring-security-jsp-authentication/pom.xml
new file mode 100644
index 0000000000..74de4d729b
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/pom.xml
@@ -0,0 +1,67 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-jsp-authentication
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-jsp-authenticate
+ Spring Security JSP Authentication tag sample
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
+ provided
+
+
+
+ javax.servlet
+ jstl
+
+
+
+ org.springframework.security
+ spring-security-taglibs
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..4057a85f13
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,20 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(Application.class);
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..fa2a324146
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,23 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/resources/application.properties b/spring-security-client/spring-security-jsp-authentication/src/main/resources/application.properties
new file mode 100644
index 0000000000..26a80c79f3
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+server.port: 8081
+spring.mvc.view.prefix: /WEB-INF/jsp/
+spring.mvc.view.suffix: .jsp
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-security-client/spring-security-jsp-authentication/src/main/webapp/WEB-INF/jsp/index.jsp
new file mode 100644
index 0000000000..90c00e980a
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -0,0 +1,24 @@
+ <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
+
+
+
+
+Spring Security JSP Authorize
+
+
+
+
+
+
+ Current user name:
+
+ Current user roles:
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authorize/.classpath b/spring-security-client/spring-security-jsp-authorize/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-jsp-authorize/.project b/spring-security-client/spring-security-jsp-authorize/.project
new file mode 100644
index 0000000000..a526feb28e
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-jsp-authorize
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-jsp-authorize/pom.xml b/spring-security-client/spring-security-jsp-authorize/pom.xml
new file mode 100644
index 0000000000..25bb21b663
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/pom.xml
@@ -0,0 +1,67 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-jsp-authorize
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-jsp-authorize
+ Spring Security JSP Authorize tag sample
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
+ provided
+
+
+
+ javax.servlet
+ jstl
+
+
+
+ org.springframework.security
+ spring-security-taglibs
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..4057a85f13
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,20 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(Application.class);
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..fa2a324146
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,23 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/resources/application.properties b/spring-security-client/spring-security-jsp-authorize/src/main/resources/application.properties
new file mode 100644
index 0000000000..26a80c79f3
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+server.port: 8081
+spring.mvc.view.prefix: /WEB-INF/jsp/
+spring.mvc.view.suffix: .jsp
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-security-client/spring-security-jsp-authorize/src/main/webapp/WEB-INF/jsp/index.jsp
new file mode 100644
index 0000000000..08af845bd4
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -0,0 +1,33 @@
+ <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
+
+
+
+
+Spring Security JSP Authorize
+
+
+
+
+
+
+
+ Only admins can see this message
+
+
+
+ Only users can see this message
+
+
+
+
+ Only users who can call "/admin" URL can see this message
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-config/.classpath b/spring-security-client/spring-security-jsp-config/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-jsp-config/.project b/spring-security-client/spring-security-jsp-config/.project
new file mode 100644
index 0000000000..9afe120f66
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-jsp-config
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-jsp-config/pom.xml b/spring-security-client/spring-security-jsp-config/pom.xml
new file mode 100644
index 0000000000..2416552d7c
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/pom.xml
@@ -0,0 +1,67 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-jsp-config
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-jsp-config
+ Spring Security JSP configuration
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
+ provided
+
+
+
+ javax.servlet
+ jstl
+
+
+
+ org.springframework.security
+ spring-security-taglibs
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..4057a85f13
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,20 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(Application.class);
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..fa2a324146
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,23 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-config/src/main/resources/application.properties b/spring-security-client/spring-security-jsp-config/src/main/resources/application.properties
new file mode 100644
index 0000000000..26a80c79f3
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+server.port: 8081
+spring.mvc.view.prefix: /WEB-INF/jsp/
+spring.mvc.view.suffix: .jsp
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-config/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-security-client/spring-security-jsp-config/src/main/webapp/WEB-INF/jsp/index.jsp
new file mode 100644
index 0000000000..bd5ccb0c78
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -0,0 +1,21 @@
+
+
+
+
+Spring Security JSP
+
+
+
+
+
+
+ Welcome
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-mvc/.classpath b/spring-security-client/spring-security-mvc/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-mvc/.project b/spring-security-client/spring-security-mvc/.project
new file mode 100644
index 0000000000..d675acbf57
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-mvc
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-mvc/pom.xml b/spring-security-client/spring-security-mvc/pom.xml
new file mode 100644
index 0000000000..ec3b1f1782
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/pom.xml
@@ -0,0 +1,45 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-mvc
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-mvc
+ Spring Security MVC
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..4057a85f13
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,20 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
+
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(Application.class);
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-mvc/src/main/resources/application.properties b/spring-security-client/spring-security-mvc/src/main/resources/application.properties
new file mode 100644
index 0000000000..c2eee0d931
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.port: 8081
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/.classpath b/spring-security-client/spring-security-thymeleaf-authentication/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/.project b/spring-security-client/spring-security-thymeleaf-authentication/.project
new file mode 100644
index 0000000000..c6b921b16c
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-thymeleaf-authentication
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/pom.xml b/spring-security-client/spring-security-thymeleaf-authentication/pom.xml
new file mode 100644
index 0000000000..cdbe0946f4
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-thymeleaf-authentication
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-thymeleaf-authentication
+ Spring Security thymeleaf authentication tag sample
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.thymeleaf.extras
+ thymeleaf-extras-springsecurity4
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..bea0194b40
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,13 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..9ade60e54c
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,42 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+@EnableWebMvc
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+ @Bean
+ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+ return new PropertySourcesPlaceholderConfigurer();
+ }
+
+ @Override
+ public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+ @Override
+ public void addResourceHandlers(final ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/application.properties b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/application.properties
new file mode 100644
index 0000000000..bafddced85
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.port=8081
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/templates/index.html b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/templates/index.html
new file mode 100644
index 0000000000..c65b5f092b
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/templates/index.html
@@ -0,0 +1,23 @@
+
+
+
+
+Spring Security Thymeleaf
+
+
+
+
+
+
+ Current user name: Bob
+
+ Current user roles: [ROLE_USER, ROLE_ADMIN]
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/.classpath b/spring-security-client/spring-security-thymeleaf-authorize/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/.project b/spring-security-client/spring-security-thymeleaf-authorize/.project
new file mode 100644
index 0000000000..b722d4072d
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-thymeleaf-authorize
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/pom.xml b/spring-security-client/spring-security-thymeleaf-authorize/pom.xml
new file mode 100644
index 0000000000..5254f1db1a
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-thymeleaf-authorize
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-thymeleaf-authorize
+ Spring Security thymeleaf authorize tag sample
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.thymeleaf.extras
+ thymeleaf-extras-springsecurity4
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..bea0194b40
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,13 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..9ade60e54c
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,42 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+@EnableWebMvc
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+ @Bean
+ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+ return new PropertySourcesPlaceholderConfigurer();
+ }
+
+ @Override
+ public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+ @Override
+ public void addResourceHandlers(final ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/application.properties b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/application.properties
new file mode 100644
index 0000000000..bafddced85
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.port=8081
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/templates/index.html b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/templates/index.html
new file mode 100644
index 0000000000..fcbbfb4957
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/templates/index.html
@@ -0,0 +1,32 @@
+
+
+
+
+Spring Security Thymeleaf
+
+
+
+
+
+
+
+ Only admins can see this message
+
+
+
+ Only users can see this message
+
+
+
+
+ Only users who can call "/admin" URL can see this message
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-config/.classpath b/spring-security-client/spring-security-thymeleaf-config/.classpath
new file mode 100644
index 0000000000..0cad5db2d0
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/.classpath
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-config/.project b/spring-security-client/spring-security-thymeleaf-config/.project
new file mode 100644
index 0000000000..f1e44573c4
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/.project
@@ -0,0 +1,48 @@
+
+
+ spring-security-thymeleaf-config
+
+
+
+
+
+ org.eclipse.wst.jsdt.core.javascriptValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+ org.eclipse.wst.jsdt.core.jsNature
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-config/pom.xml b/spring-security-client/spring-security-thymeleaf-config/pom.xml
new file mode 100644
index 0000000000..ec145a29c8
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ spring-security-thymeleaf-config
+ 0.0.1-SNAPSHOT
+ war
+
+ spring-security-thymeleaf-config
+ Spring Security thymeleaf configuration sample project
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.thymeleaf.extras
+ thymeleaf-extras-springsecurity4
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+ UTF-8
+ 1.8
+
+
+
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/Application.java b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/Application.java
new file mode 100644
index 0000000000..bea0194b40
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/Application.java
@@ -0,0 +1,13 @@
+package org.baeldung.config;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/MvcConfig.java b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/MvcConfig.java
new file mode 100644
index 0000000000..9ade60e54c
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/MvcConfig.java
@@ -0,0 +1,42 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+@EnableWebMvc
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ public MvcConfig() {
+ super();
+ }
+
+ //
+ @Bean
+ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+ return new PropertySourcesPlaceholderConfigurer();
+ }
+
+ @Override
+ public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
+ registry.addViewController("/").setViewName("forward:/index");
+ registry.addViewController("/index");
+ }
+
+ @Override
+ public void addResourceHandlers(final ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/SecurityConfig.java
new file mode 100644
index 0000000000..bd6c56d38a
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/java/org/baeldung/config/SecurityConfig.java
@@ -0,0 +1,40 @@
+package org.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ // @formatter:off
+ auth.inMemoryAuthentication()
+ .withUser("john").password("123").roles("USER")
+ .and()
+ .withUser("tom").password("111").roles("ADMIN");
+ // @formatter:on
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ web.ignoring().antMatchers("/resources/**");
+ }
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ // @formatter:off
+ http.authorizeRequests()
+ .antMatchers("/login").permitAll()
+ .antMatchers("/admin").hasRole("ADMIN")
+ .anyRequest().authenticated()
+ .and().formLogin().permitAll()
+ ;
+ // @formatter:on
+ }
+}
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/resources/application.properties b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/application.properties
new file mode 100644
index 0000000000..bafddced85
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.port=8081
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/resources/templates/index.html b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/templates/index.html
new file mode 100644
index 0000000000..8e7394ad6a
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/templates/index.html
@@ -0,0 +1,21 @@
+
+
+
+
+Spring Security Thymeleaf
+
+
+
+
+
+
+ Welcome
+
+
+
\ No newline at end of file