blob: b0fab0c5bcfa52a36c3d82bd04f010d28ebb9715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
This sample project shows how to add Spring Security to a Spring Boot application.
To run with support for hot swap during development, use the dev profile as follows:
mvn spring-boot:run -Dspring-boot.run.profiles=dev
Two dependencies have been added to pom.xml.
After starting the application, look for the default password that appears on the console.
The default user name is 'user' without quotes.
Access the Contact page from a web browser and observe that a CSRF token has got added to the form html automatically.
The application has been modified to show a logout link in the main navigation bar.
Check how that link has been added in the main.html file where the link is visible only if the user has logged in.
Since all pages of the application are secured (except the login page), the logout link could have been displayed without using the sec:authorize attribute. It has been used in the web page just to show the capability. It is useful in cases where some pages are shown to unauthenticated users.
|