inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Spring Boot JWT Tutorial

Security 설정, Data 설정

WebSecurityConfigurerAdapter deprecated

해결된 질문

2430

Jeong-Woo Kang

작성한 질문수 2

0

WebSecurityConfigurerAdapter 가 이제 더 이상 지원을 하지 않는다고 하여 WebSecurityFilterChain으로 하래서 시도중인데 계속하여 401 에러가 뜹니다...

@EnableWebSecurity
public class SecurityConfig {
    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
        http
                .authorizeRequests() 
                .antMatchers("api/hello").permitAll()
                .anyRequest().authenticated(); 

        return http.build();
    }

}

deprecated spring-boot websecurityconfig jwt

답변 4

2

Kang ho Lee

그리고 antMatchers도 deprecated 되어서 밑에와 같은 방식으로 해주시면 진행 될거에요.

@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
                .authorizeHttpRequests()
                .requestMatchers("/api/hello").permitAll()
                .anyRequest().authenticated();

        return http.build();
    }
}

0

정은구

안녕하세요 🙂

Spring Boot 3.4.0 (SNAPSHOT) 버전에 맞춰 샘플 코드를 업데이트했습니다.

아래 링크에서 Java와 Kotlin 버전의 최신 샘플 코드를 확인하실 수 있으니 참고 부탁드립니다.

Javahttps://github.com/SilverNine/spring-boot-jwt-tutorial

Kotlinhttps://github.com/SilverNine/spring-boot-jwt-tutorial-kotlin

0

준준

api 앞에 "/" 빠져서 그런거 아닌가요?

0

배상혁

@EnableWebSecurity 대신에 @Configuration 한번 달아보실래요?

spring boot 3.x 버전 강의도 만들어주시면 안될까요?

0

67

1

3강 secret key 관련해서 질문있습니다

0

66

1

JwtFilter 에 TokenProvider 선언 시 final 키워드 빠진 이유

0

76

1

/api/authenticate 포스트맨 401 에러

0

223

1

Spring boot 3.x버전에서 data.sql 오류 발생할 경우

4

399

1

/api/hello 접근 시 401 나올 때 해결법

2

302

2

소스코드 전체 볼수 있을까요?

0

397

2

머이렇게 안되는게많노 ㅠ

1

757

2

스프링부트 3.x 버전 data.sql 삽입 오류 발생할 경우 해결 방법

6

1350

2

postman 결과가 다릅니다

0

355

2

body값이 비었습니다.

0

399

2

jjwt 버전을 올렸더니 jwt가 유효하지 않다고 합니다

0

3592

1

Refresh Token

0

506

1

유저 권한 설정

0

368

2

setAuthentication

0

496

1

postman에서 오류가 납니다..

0

1766

3

Spring boot 3.1.5 기준 학습 정리 파일 공유

1

1084

4

/api/hello에 접근이 안됩니다 ㅠㅠ

0

1082

2

mysql 설정로 실습시

0

873

2

유효한 JWT 토큰이 없습니다

0

667

2

8:45 spring security 3.1.5 설정 방법 (버전 안 맞춰서 안될때)

1

2279

2

2:00 에서 저처럼 버전 안 맞춰서 해서 헤매는 분들 이걸로 해보세요.

0

1275

3

JWT String argument cannot be null or empty.

0

2157

2

new User 생성자 오류 발생하는 분들...

6

501

2