스프링 시큐리티 관련 질문

스프링 시큐리티 관련 질문

작성일 2023.09.03댓글 1건
    게시물 수정 , 삭제는 로그인 필요

다음과 같이 "/webjars/**", "/js/**", "/image/**", "/", "/auth/**" 이 경로들은 인증 없이 접근을 허용하도록 했는데 모든 화면이 403 forbidden이 출력됩니다. 이 문제를 해결하려면 어떻게 해야할지 궁금합니다.
--------------------------------------------------------------------------------------
package com.ssamz.jblog.config;

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.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

@Configuration
@EnableWebSecurity
public class JBlogWebSecurityConfiguration {
    @Bean
    protected SecurityFilterChain webSecurityFilterChain(HttpSecurity http) throws Exception {
// 인증 없이 접근을 허용하는 경로
    // "/webjars/**", "/js/**", "/image/**", "/", "/auth/**"
http
.cors(AbstractHttpConfigurer::disable)
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth -> auth.requestMatchers(new AntPathRequestMatcher("/webjars/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/js/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/image/**")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/")).permitAll()
.requestMatchers(new AntPathRequestMatcher("/auth/**")).permitAll()
.anyRequest().authenticated()
);
return http.build();
}
}
--------------------------------------------------------------------------------------


#스프링 시큐리티 #스프링 시큐리티 로그인 #스프링 시큐리티 jwt #스프링 시큐리티 로그인 페이지 없애기 #스프링 시큐리티 쓰는 이유 #스프링 시큐리티 jwt 로그인 #스프링 시큐리티 로그아웃 #스프링 시큐리티 oauth2 #스프링 시큐리티 인 액션 #스프링 시큐리티 필터

profile_image 익명 작성일 -

package com.ssamz.jblog.config; 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.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class JBlogWebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/webjars/**", "/js/**", "/image/**", "/", "/auth/**") .permitAll() .anyRequest() .authenticated() .and() .cors() .and() .csrf() .disable(); } }

개인 프로젝트

... 있으면 관련된거 계속 검색하고 구현하고 무슨... 언어 - 스프링 시큐리티 - mysql - jpa *프로젝트 주제 - 게시판... 개발에 대한 질문이나 의견을 나눌 수 있는 곳을 찾아서...

웹개발과 spring 설정과 그외 질문입니다

... 2.웹사이트내에서 글 삭제시 현업에서 정말로 관련된... 4.스프링 시큐리티는 선택이 아닌 필수인가요? 기존에... 추상적인 질문이긴 한데 현업에서 웹사이트 하나를...

jsp 질문드립니다

... 스프링 시큐리티 사용중이시면 관련 jstl 을 임포트하고 권한체크를 하시면 될거 같구 아니면 userVo에 권한관련 변수 지정해서 그값 체크하면 되지 않을까...

대전에 구형 쏘렌토 이쁘게...

... 타이어, 스프링이나, 쇼바 바꾸고, 부싱갈고 네비... 관련 좋은 카페나 싸이트있으면 알려주시구요!! 질문이... 실내등 + 시큐리티 ) ※실외※( 사이드리피터...

만약에 제가 컴퓨터공학과에 간다고하면

... ' 라는 질문에 '기본적인 명령어만 안다'라고 대답할 정도면 됨. CCNA, CCNP 네트워크 관련 과목임. 앞선... 제공하는 스프링 시큐리티를 어떻게 사용했고, DB는 스프링...

스프링 시큐리티 .csrf() 관련 질문드립...

.csrf()를 설정하면 토큰 값을 넘겨주는 것으로 알고 있는데 그 토큰 값은 클라이언트 어디에 저장되나요 브라우저 쿠키 값으로 저장되는건가요? 보통 토큰 값은 로그인할...