Skip to content

Commit

Permalink
Feat(#2): spring security 기본 설정 추가 및 default login page disable
Browse files Browse the repository at this point in the history
  • Loading branch information
versatile0010 committed Oct 1, 2023
1 parent 3d55812 commit 9b18239
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/com/numberone/backend/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.numberone.backend.config;

import lombok.extern.slf4j.Slf4j;
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.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.config.annotation.web.configurers.HttpBasicConfigurer;
import org.springframework.security.web.SecurityFilterChain;

@Slf4j
@Configuration
@EnableWebSecurity
public class SecurityConfig {

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((auth) -> auth
.anyRequest().authenticated() // 모든 요청에 대한 인증 처리하도록 설정
)
.httpBasic(HttpBasicConfigurer::disable);
return http.build();
}

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
return (web) -> web.ignoring()
.requestMatchers("/*"); // 인증 처리 하지 않을 케이스
}
}

0 comments on commit 9b18239

Please sign in to comment.