이전 수업보단 좀더 편리한 방법
네임 스페이스를 등록
<html lang="en" xmlns:th="<http://www.thymeleaf.org>" xmlns:sec="<http://www.thymeleaf.org/extras/spring-security>">
이것 쓰는게 귀찮아서 그렇지 오타없이 잘 쓰기만 하면 편리해 진다.
authorize-exp도 자동완성이 된다.
<!DOCTYPE html>
<html lang="en" xmlns:th="<http://www.thymeleaf.org>" xmlns:sec="<http://www.thymeleaf.org/extras/spring-security>">
<head>
<meta charset="UTF-8">
<title>index</title>
</head>
<body>
<h1 th:text="${message}">hello</h1>
<div sec:authorize-expr="isAuthenticated()">
<h2 sec:authentication="name">Name</h2>
<a href="/logout" th:href="@{/logout}">Logout</a>
</div>
<div sec:authorize-expr="!isAuthenticated()">
<a href="/login" th:href="@{/login}">Login</a>
</div>
</body>
</html>