CustomSecurityConfig
페이지 정보
본문
package web.config;
import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Configuration
@RequiredArgsConstructor
public class CustomSecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
log.info("-------시큐리티 해제-------");
http.formLogin();
return http.build();
}
@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
log.info("-------시큐리티 적용 제외-------");
return (web) -> web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations());
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
- 이전글● PasswordEncoder 24.07.18
- 다음글CustomUserDetailsService 24.07.18
댓글목록
등록된 댓글이 없습니다.