|
@@ -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">
|