From 4708287ad352893ef935094518ff21e3b296581b Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Thu, 12 Dec 2013 15:17:42 -0600 Subject: [PATCH] SEC-2444: Convert Java Config samples to thymeleaf and tiles --- .gitignore | 1 + build.gradle | 1 + .../secure-the-application.asc | 2 - docs/guides/src/asciidoc/form.asc | 67 +- docs/guides/src/asciidoc/hellomvc.asc | 58 +- gradle/javaprojects.gradle | 1 + ...sageSecurityWebApplicationInitializer.java | 9 +- .../samples/config/SecurityConfig.java | 16 +- .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 39 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - ...sageSecurityWebApplicationInitializer.java | 1 - .../src/main/resources/views/login.html | 27 + .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- ...sageSecurityWebApplicationInitializer.java | 2 - .../resources/js/bootstrap.js | 0 .../resources/js/jquery-1.8.3.js | 0 .../resources/js/knockout-2.3.0.js | 0 .../resources/js/message.js | 0 .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 149 - .../webapp/WEB-INF/views/messages/inbox.jspx | 184 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../samples/config/SecurityConfig.java | 18 +- .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 39 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../samples/config/SecurityConfig.java | 15 +- .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 39 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../samples/config/SecurityConfig.java | 15 +- .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 39 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes samples/messages-jc/build.gradle | 5 +- samples/messages-jc/pom.xml | 18 +- .../MessageWebApplicationInitializer.java | 7 +- .../samples/mvc/MessageController.java | 7 + .../mvc/config/WebMvcConfiguration.java | 41 +- .../resources/css/bootstrap-responsive.css | 0 .../resources}/resources/css/bootstrap.css | 0 .../main/resources}/resources/img/favicon.ico | Bin .../main/resources}/resources/img/logo.png | Bin .../src/main/resources/tiles/tiles-def.xml | 57 + .../src/main/resources/views/layout.html | 122 + .../resources/views/messages/compose.html | 40 + .../main/resources/views/messages/inbox.html | 29 + .../main/resources/views/messages/show.html | 20 + .../samples/config/SecurityConfig.java | 2 +- .../resources/css/openid.css | 0 .../main/resources}/resources/img/favicon.ico | Bin .../main/resources}/resources/img/logo.png | Bin .../resources/js/jquery-1.2.6.min.js | 0 .../js/openid-client/jquery.query-2.1.3.js | 0 .../js/openid-client/openid-client-config.js | 0 .../js/openid-client/openid-client.js | 0 .../resources/js/openid-jquery.js | 0 .../views/user/show.jspx | 0 .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 68 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/aol.gif | Bin 2205 -> 0 bytes .../src/main/webapp/resources/img/blogger.ico | Bin 3638 -> 0 bytes .../src/main/webapp/resources/img/claimid.ico | Bin 3638 -> 0 bytes .../main/webapp/resources/img/facebook.gif | Bin 2075 -> 0 bytes .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/flickr.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/google.gif | Bin 1596 -> 0 bytes .../main/webapp/resources/img/livejournal.ico | Bin 5222 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../main/webapp/resources/img/myopenid.ico | Bin 2862 -> 0 bytes .../webapp/resources/img/openid-inputicon.gif | Bin 237 -> 0 bytes .../src/main/webapp/resources/img/openid.gif | Bin 740 -> 0 bytes .../main/webapp/resources/img/technorati.ico | Bin 2294 -> 0 bytes .../main/webapp/resources/img/verisign.gif | Bin 2550 -> 0 bytes .../main/webapp/resources/img/verisign.ico | Bin 4710 -> 0 bytes .../src/main/webapp/resources/img/vidoop.ico | Bin 1406 -> 0 bytes .../main/webapp/resources/img/wordpress.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/yahoo.gif | Bin 1682 -> 0 bytes .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 36 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes .../src/main/webapp/WEB-INF/decorators.xml | 5 - .../main/webapp/WEB-INF/decorators/main.jsp | 138 - .../src/main/webapp/WEB-INF/views/login.jspx | 41 - .../WEB-INF/views/messages/compose.jspx | 26 - .../webapp/WEB-INF/views/messages/inbox.jspx | 40 - .../webapp/WEB-INF/views/messages/show.jspx | 24 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes samples/x509-jc/src/etc/server.xml | 18 +- .../samples/config/SecurityConfig.java | 1 - .../resources/css/bootstrap-responsive.css | 1092 --- .../main/webapp/resources/css/bootstrap.css | 6039 ----------------- .../src/main/webapp/resources/img/favicon.ico | Bin 1150 -> 0 bytes .../src/main/webapp/resources/img/logo.png | Bin 1123 -> 0 bytes 154 files changed, 416 insertions(+), 81271 deletions(-) delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/concurrency-jc/src/main/webapp/WEB-INF/views/messages/show.jspx create mode 100644 samples/form-jc/src/main/resources/views/login.html delete mode 100644 samples/form-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/form-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/form-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/form-jc/src/main/webapp/resources/css/bootstrap.css rename samples/hellojs-jc/src/main/{webapp => resources}/resources/js/bootstrap.js (100%) rename samples/hellojs-jc/src/main/{webapp => resources}/resources/js/jquery-1.8.3.js (100%) rename samples/hellojs-jc/src/main/{webapp => resources}/resources/js/knockout-2.3.0.js (100%) rename samples/hellojs-jc/src/main/{webapp => resources}/resources/js/message.js (100%) delete mode 100644 samples/hellojs-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/hellojs-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/hellojs-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/hellojs-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/hellojs-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/hellojs-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/hellojs-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/hellomvc-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/hellomvc-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/hellomvc-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/hellomvc-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/hellomvc-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/hellomvc-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/hellomvc-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/hellomvc-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/hellomvc-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/inmemory-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/inmemory-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/inmemory-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/inmemory-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/inmemory-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/insecuremvc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/insecuremvc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/insecuremvc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/insecuremvc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/jdbc-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/jdbc-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/jdbc-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/jdbc-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/jdbc-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/ldap-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/ldap-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/ldap-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/ldap-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/ldap-jc/src/main/webapp/resources/img/logo.png rename samples/{concurrency-jc/src/main/webapp => messages-jc/src/main/resources}/resources/css/bootstrap-responsive.css (100%) rename samples/{concurrency-jc/src/main/webapp => messages-jc/src/main/resources}/resources/css/bootstrap.css (100%) rename samples/{concurrency-jc/src/main/webapp => messages-jc/src/main/resources}/resources/img/favicon.ico (100%) rename samples/{concurrency-jc/src/main/webapp => messages-jc/src/main/resources}/resources/img/logo.png (100%) create mode 100644 samples/messages-jc/src/main/resources/tiles/tiles-def.xml create mode 100644 samples/messages-jc/src/main/resources/views/layout.html create mode 100644 samples/messages-jc/src/main/resources/views/messages/compose.html create mode 100644 samples/messages-jc/src/main/resources/views/messages/inbox.html create mode 100644 samples/messages-jc/src/main/resources/views/messages/show.html rename samples/openid-jc/src/main/{webapp => resources}/resources/css/openid.css (100%) rename samples/{form-jc/src/main/webapp => openid-jc/src/main/resources}/resources/img/favicon.ico (100%) rename samples/{form-jc/src/main/webapp => openid-jc/src/main/resources}/resources/img/logo.png (100%) rename samples/openid-jc/src/main/{webapp => resources}/resources/js/jquery-1.2.6.min.js (100%) rename samples/openid-jc/src/main/{webapp => resources}/resources/js/openid-client/jquery.query-2.1.3.js (100%) rename samples/openid-jc/src/main/{webapp => resources}/resources/js/openid-client/openid-client-config.js (100%) rename samples/openid-jc/src/main/{webapp => resources}/resources/js/openid-client/openid-client.js (100%) rename samples/openid-jc/src/main/{webapp => resources}/resources/js/openid-jquery.js (100%) rename samples/openid-jc/src/main/{webapp/WEB-INF => resources}/views/user/show.jspx (100%) delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/openid-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/openid-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/openid-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/aol.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/blogger.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/claimid.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/facebook.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/flickr.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/google.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/livejournal.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/myopenid.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/openid-inputicon.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/openid.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/technorati.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/verisign.gif delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/verisign.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/vidoop.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/wordpress.ico delete mode 100644 samples/openid-jc/src/main/webapp/resources/img/yahoo.gif delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/preauth-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/preauth-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/preauth-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/preauth-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/preauth-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/decorators.xml delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/decorators/main.jsp delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/views/login.jspx delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/views/messages/compose.jspx delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/views/messages/inbox.jspx delete mode 100644 samples/rememberme-jc/src/main/webapp/WEB-INF/views/messages/show.jspx delete mode 100644 samples/rememberme-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/rememberme-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/rememberme-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/rememberme-jc/src/main/webapp/resources/img/logo.png delete mode 100644 samples/x509-jc/src/main/webapp/resources/css/bootstrap-responsive.css delete mode 100644 samples/x509-jc/src/main/webapp/resources/css/bootstrap.css delete mode 100644 samples/x509-jc/src/main/webapp/resources/img/favicon.ico delete mode 100644 samples/x509-jc/src/main/webapp/resources/img/logo.png diff --git a/.gitignore b/.gitignore index e56d60133e..3edb6888c2 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ build/ *.iws .gradle/ atlassian-ide-plugin.xml +/samples diff --git a/build.gradle b/build.gradle index 7c8906519d..43abb1f7ed 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ allprojects { group = 'org.springframework.security' repositories { + mavenCentral() maven { url "http://repo.springsource.org/plugins-release" } maven { url "http://repo.terracotta.org/maven2/" } } diff --git a/docs/guides/src/asciidoc/_hello-includes/secure-the-application.asc b/docs/guides/src/asciidoc/_hello-includes/secure-the-application.asc index 22dbe14a99..95f4463d3b 100644 --- a/docs/guides/src/asciidoc/_hello-includes/secure-the-application.asc +++ b/docs/guides/src/asciidoc/_hello-includes/secure-the-application.asc @@ -50,8 +50,6 @@ The next step is to create a Spring Security configuration. ---- package org.springframework.security.samples.config; -import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.context.annotation.*; import org.springframework.security.config.annotation.authentication.builders.*; import org.springframework.security.config.annotation.web.configuration.*; diff --git a/docs/guides/src/asciidoc/form.asc b/docs/guides/src/asciidoc/form.asc index 3037ea2462..66ea0b6770 100644 --- a/docs/guides/src/asciidoc/form.asc +++ b/docs/guides/src/asciidoc/form.asc @@ -150,65 +150,48 @@ public class WebMvcConfiguration extends WebMvcConfigurerAdapter { registry.addViewController("/login").setViewName("login"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); } - - @Bean - public InternalResourceViewResolver jspxViewResolver() { - InternalResourceViewResolver result = new InternalResourceViewResolver(); - result.setPrefix("/WEB-INF/views/"); - result.setSuffix(".jspx"); - return result; - } } ---- == Creating a login view -Our existing configuration means that all we need to do is create a *login.jspx* file with the following contents: +Our existing configuration means that all we need to do is create a *login.html* file with the following contents: -.src/main/webapp/WEB-INF/views/login.jspx +.src/main/resources/views/login.html [source,xml] ---- - - - - -Please Login - - - - <1> -
- Please Login - <2> -
+ + + Messages : Create + + +
+
<1> +
+ Please Login +
<2> Invalid username and password.
- - <3> -
+
<3> You have been logged out.
- - - <4> - - <5> -
- -
-
- - + + <4> + + <5> +
+ +
+
+ + + -
---- <1> The URL we submit our username and password to is the same URL as our login form (i.e. */login*), but a *POST* instead of a *GET*. <2> When authentication fails, the browser is redirected to */login?error* so we can display an error message by detecting if the parameter *error* is non-null. -<3> When we are successfully loged out, the browser is redirected to */login?logout* so we can display an logout success message by detecting if the parameter *logout* is non-null. +<3> When we are successfully logged out, the browser is redirected to */login?logout* so we can display an logout success message by detecting if the parameter *logout* is non-null. <4> The username should be present on the HTTP parameter username <5> The password should be present on the HTTP parameter password diff --git a/docs/guides/src/asciidoc/hellomvc.asc b/docs/guides/src/asciidoc/hellomvc.asc index ea33f4b9b2..36e224a989 100644 --- a/docs/guides/src/asciidoc/hellomvc.asc +++ b/docs/guides/src/asciidoc/hellomvc.asc @@ -34,16 +34,14 @@ We have created the Spring Security configuration, but we still need to register ---- package org.springframework.security.samples.config; -import org.springframework.core.annotation.*; import org.springframework.security.web.context.*; -@Order(2) public class MessageSecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer { } ---- -The `MessageSecurityWebApplicationInitializer` will automatically register the springSecurityFilterChain Filter for every URL in your application. We add `@Order(2)` so the springSecurityFilterChain is inserted before our Sitemesh Filter declared in <> +The `MessageSecurityWebApplicationInitializer` will automatically register the springSecurityFilterChain Filter for every URL in your application. If Filters are added within other `WebApplicationInitializer` instances we can use `@Order` to control the ordering of the Filter instances. === Verify SecurityConfig is loaded @@ -53,7 +51,6 @@ Just because <> exists, does not mean that .MessageWebApplicationInitializer.java [source,java] ---- -@Order(1) public class MessageWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @@ -86,64 +83,39 @@ include::{hello-include-dir}/exploring-the-secured-application.asc[] ==== Displaying the user name -Now that we have authenticated, let's update the application to display the username if the user is authenticated. Update main.jsp to contain the following snippet: +Now that we have authenticated, let's see how our application is displaying the username if the user is authenticated. -.src/main/webapp/WEB-INF/decorators/main.jsp +.messages-jc/src/main/resources/views/layout.html [source,html] -[subs="verbatim,quotes"] ---- -