4.1 스프링 시큐리티 활성화하기

스프링 애플리케이션의 보안에서 처음 할 일은 pom.xml에 명세를 추가하는 것이다.

<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-test</artifactId>
		<scope>test</scope>
</dependency>

이제 애플리케이션을 실행시킨뒤 localhost:8080/design에 접속하면 아래와 같은 화면이 보인다.

스크린샷 2024-01-28 오후 2.52.18.png

Username 필드에는 user를, Password 필드에는 애플리케이션 로그에 생성된 비밀번호를 입력하면 된다.

스크린샷 2024-01-28 오후 2.51.34.png

스프링 시큐리티가 제공하는 자동 보안 구성은 아래와 같다.