
1.의의
2.Basic 인증 구현
1)설정 파일을 만든다.
package io.security.basicsecurity;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.authorizeRequests()
.anyRequest().authenticated();
http
.httpBasic();
}
}
2)application.properties 에 사용자 이름과 비밀번호를 설정한다.
spring.security.user.name=user
spring.security.user.password=1234