-
Security Configuration 클래스 기본 설정SPRING/스프링 시큐리티 2021. 8. 1. 11:37
Security Configuration(설정) 관련 클래스는 WebSecurityConfigurerAdapter를 상속하고, 세부적인 보안 기능을 설정할 수 있는 HttpSecurity API를 제공한다,
HttpSecurity API는 크게 인증 API, 인가 API를 제공한다.
인증 : 계정인증에 대한 설정
인가 : 계정의 Role, 권한에 대한 설정
@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // 모든 리소스에 대한 인증완료시 접근 허용 http .authorizeRequests() .anyRequest().authenticated(); // form Login 사용 http.formLogin(); } }
application.properties 파일에 아래와 같이 계정 아이디 비밀번호 세팅하면 form Login에서 해당 아이디 비밀번호를 사용할 수 있다.
spring.security.user.name=user
spring.security.user.password=1111'SPRING > 스프링 시큐리티' 카테고리의 다른 글
세션 정책 및 고정세션 공격방지 (0) 2021.08.03 remember-me (0) 2021.08.01 로그아웃 (0) 2021.08.01 FORM 인증 - 기본 (0) 2021.08.01 의존성 추가 및 기본 세팅 (0) 2021.08.01