admin: security header 기본 보안 기능 추가
This commit is contained in:
parent
a6f900f0e7
commit
e368414006
|
|
@ -5,9 +5,11 @@ import com.bpgroup.poc.admin.security.authentication.AuthenticationFailException
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.Customizer;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.header.writers.XXssProtectionHeaderWriter;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
import java.util.Objects;
|
||||
|
|
@ -22,6 +24,14 @@ public class SecurityConfig {
|
|||
|
||||
@Bean
|
||||
SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||
// 보안 기본 설정
|
||||
http.headers(c -> c
|
||||
.frameOptions(fo -> fo.sameOrigin()) // X-Frame-Options: Same Origin
|
||||
.xssProtection(xp -> xp.headerValue(XXssProtectionHeaderWriter.HeaderValue.ENABLED_MODE_BLOCK)) // X-XSS-Protection: 1; mode=block
|
||||
.contentTypeOptions(Customizer.withDefaults()) // X-Content-Type-Options: nosniff
|
||||
.cacheControl(cache -> cache.disable()) //ERR_CACHE_MISS
|
||||
);
|
||||
|
||||
// 인증 설정
|
||||
http.authorizeHttpRequests(c -> c
|
||||
.requestMatchers("/css/**", "/images/**", "/js/**").permitAll()
|
||||
|
|
|
|||
Loading…
Reference in New Issue