Maven project - pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
Gradle project - build.gradle
implementation 'org.springframework.boot:spring-boot-starter-security'
모든 요청은 인증이 되어야 자원에 접근이 가능하다.
인증 방식은 폼 로그인 방식과 httpBasic
로그인 방식을 제공한다.
기본 로그인 페이지 제공
기본 계정 한 개 제공 user/랜덤문자열
참고: 개발도중 매번 생성되는 랜덤문자열/계정으로 로그인하는것은 까다롭다. application.properties에 기본 name/password설정이 가능하다.
spring.security.user.name=user
spring.security.user.password=1234
스프링 시큐리티의 웹 보안 기능 초기화 및 설정 :
WebSecurityConfigurerAdapter