说明
(1)JDK版本:1.8
(2)Spring Boot 2.0.6
(3)Spring Security 5.0.9
(4)Spring Data JPA 2.0.11.RELEASE
(5)hibernate5.2.17.Final
(6)MySQLDriver 5.1.47
(7)MySQL 8.0.12
需求缘起
现在在页面当中还无法进行退出登录的地方,另外403 Error Page页面实在是不友好,还是需要优化下的。
一、退出登录
退出登录特别的简单,这个Spring Security就已经帮我们实现了,只需要在index.html使用form表单post方式,提交/logout请求即可,如下示例代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>Spring Security入门</title>
</head>
<body>
<h1>欢迎使用Sprin