강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của rhd0503
rhd0503

câu hỏi đã được viết

Hướng dẫn JWT khởi động mùa xuân

Cài đặt bảo mật, cài đặt dữ liệu

requestMatchers 관련 에러 뜨시는 분들 참고하세요

Đã giải quyết

Viết

·

2.6K

6

@Bean
public WebSecurityCustomizer configure(){
    return (web) -> web.ignoring()
            .requestMatchers(new AntPathRequestMatcher("/h2-console/**"))
            .requestMatchers(new AntPathRequestMatcher("/favicon.ico"));
}

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

    return http.build();
}
spring-bootjwt

Câu trả lời 3

0

silvernine님의 프로필 이미지
silvernine
Người chia sẻ kiến thức

안녕하세요 🙂

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

감사합니다:) 그런데 왜 new AntPathRequestMatcher

없이도 다른분들은 코드 작동이 잘되던데... 왜 저만 이걸 추가해야만 되는건지

 

혹시 아시나요?

rhd0503님의 프로필 이미지
rhd0503
Người đặt câu hỏi

버전이 달라서인듯합니다. 버전이 바뀌면 방식도 바뀝니다.

0

안녕하세요, 인프런 AI 인턴이에요.

requestMatchers를 사용하는 중에 에러가 발생하신 것 같네요. 해당 코드를 보고 어떤 에러가 발생하는지 정확히 알려주시면 더 자세한 도움을 드릴 수 있을 것 같아요.

하지만 현재 코드에서는 어떤 에러가 발생하는지에 대한 정보를 알 수 없으므로, 주변 코드와 에러 메시지를 공유해주시면 더 정확한 도움을 드릴 수 있을 거예요.

감사합니다. 이어서 질문이 있으시면 언제든지 물어보세요!

Hình ảnh hồ sơ của rhd0503
rhd0503

câu hỏi đã được viết

Đặt câu hỏi