스프링 기반의 애플리케이션 보안을 담당하는 스프링 하위 프레임워크.
교재에 따라 의존성을 추가하고, User 엔티티를 추가하는 작업을 가장 먼저 진행했다.
리포지터리 작성, 서비스 메서드 추가, 시큐리티 설정, 컨트롤러 작성, 뷰 구현을 마치고 정상적으로 작동하는 부분까지 실행하였다.
작성하면서 신경쓰이는 부분이 있었는데, 바로 아래 코드의 name="username" 부분이다.
<form action="/login" method="POST">
<input type="hidden" th:name="${_csrf?.parameterName}" th:value="${_csrf?.token}" />
<div class="mb-3">
<label class="form-label text-white">Email address</label>
<input type="email" class="form-control" name="username">
</div>
<div class="mb-3">
<label class="form-label text-white">Password</label>
<input type="password" class="form-control" name="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
나는 교재를 따라 쓰면서 username을 받는 리퀘스트를 작성한 적이 없는데 어떻게 작동이 가능한 걸까?
코드를 다시 살펴보니 Post mapping이 된 login 컨트롤러도 작성한 적이 없다.
이런 부분이 오히려 자세히 설명이 필요한 것 같은데, 책에는 나와있지 않아 아쉽다.

코드가 제대로 작동할 수 있는 이유는 시큐리티 설정을 진행하며 formLogin()코드를 추가해주었기 때문이다.
로그인 요청을 하면 Post mapping으로 username과 password 데이터가 서버에 전송된다고 한다.
참고 : https://velog.io/@seongwon97/Spring-Security-Form-Login
Spring Security 공식 홈페이지 : https://docs.spring.io/spring-security/reference/servlet/authentication/passwords/form.html