Use xml / javaconfig folders for samples

Fixes gh-3752
This commit is contained in:
Joe Grandja
2016-04-11 10:47:06 -04:00
committed by Rob Winch
parent 2c85fb05d0
commit 945a21a3fb
543 changed files with 828 additions and 430 deletions

View File

@@ -1,7 +1,7 @@
= Creating a Custom Login Form
:author: Rob Winch
:starter-appname: hellomvc-jc
:completed-appname: form-jc
:starter-appname: javaconfig/hellomvc
:completed-appname: javaconfig/form
:include-dir: _includes
This guide builds off of link:hellomvc.html[Hello Spring MVC Security Java Config] to explain how to configure and use a custom login form with Spring Security Java Configuration.
@@ -133,7 +133,7 @@ Within Spring Web MVC there are two steps to creating our login page:
== Configuring a login view controller
Within Spring Web MVC, the first step is to ensure that we have a controller that can point to our view. Since our project adds the *messages-jc* project as a dependency and it contains a view controller for */login* we do not need to create a controller within our application. For reference, you can see the configuration below:
Within Spring Web MVC, the first step is to ensure that we have a controller that can point to our view. Since our project adds the *javaconfig/messages* project as a dependency and it contains a view controller for */login* we do not need to create a controller within our application. For reference, you can see the configuration below:
[source,java]
----

View File

@@ -1,7 +1,7 @@
= Hello Spring MVC Security Java Config
:author: Rob Winch
:starter-appname: insecuremvc
:completed-appname: hellomvc-jc
:completed-appname: javaconfig/hellomvc
:include-dir: _includes
:hello-include-dir: _hello-includes
@@ -45,7 +45,7 @@ The `MessageSecurityWebApplicationInitializer` will automatically register the s
=== Verify SecurityConfig is loaded
Just because <<security-config-java,SecurityConfig>> exists, does not mean that our Spring application knows about it. In this instance, our Spring root application context is initialized using MessageWebApplicationInitializer which is included with our spring-security-samples-messages-jc project. You can find a snippet of it below:
Just because <<security-config-java,SecurityConfig>> exists, does not mean that our Spring application knows about it. In this instance, our Spring root application context is initialized using MessageWebApplicationInitializer which is included with our spring-security-samples-javaconfig-messages project. You can find a snippet of it below:
[[message-web-application-inititializer-java]]
.MessageWebApplicationInitializer.java
@@ -63,7 +63,7 @@ public class MessageWebApplicationInitializer extends
}
----
You will notice it is loading the `RootConfiguration` class which is also included in our spring-security-samples-messages-jc project.
You will notice it is loading the `RootConfiguration` class which is also included in our spring-security-samples-javaconfig-messages project.
[[root-configuration-java]]
.RootConfiguration.java
@@ -85,7 +85,7 @@ include::{hello-include-dir}/exploring-the-secured-application.asc[]
Now that we have authenticated, let's see how our application is displaying the username if the user is authenticated.
.messages-jc/src/main/resources/views/layout.html
.messages/src/main/resources/views/layout.html
[source,html]
----
<div th:if="${#httpServletRequest.remoteUser != null}">
@@ -103,7 +103,7 @@ WARNING: The Thymeleaf ensures the username is escaped to avoid http://en.wikipe
We can view the user name, but how are we able to log out? Below you can see how we are able to log out.
.messages-jc/src/main/resources/views/layout.html
.messages/src/main/resources/views/layout.html
[source,html]
----
<form th:action="@{/logout}" method="post">

View File

@@ -1,7 +1,7 @@
= Hello Spring Security Java Config
:author: Rob Winch
:starter-appname: insecure
:completed-appname: helloworld-jc
:completed-appname: javaconfig/helloworld
:include-dir: _includes
:hello-include-dir: _hello-includes