728x90
반응형
SMALL
18강 (03/30)
403 에러 - 인증되지 않음
@EnableWebSecurity //해당 파일로 시큐리티를 활성화
@Configuration //IoC 등록
public class SecurityConfig extends WebSecurityConfigurerAdapter{public SecurityConfig() {
}@Override
protected void configure(HttpSecurity http) throws Exception {
//super 삭제 - 기존 시큐리티가 가지고 있는 기능이 다 비활성화 됨.
http.authorizeRequests()
.antMatchers("/","/user/**", "/image/**", "/subscribe/**","/comment/**").authenticated()
.anyRequest().permitAll() //모든 요청 포용
.and()
.formLogin()
.loginPage("/auth/signin")
.defaultSuccessUrl("/");
}
}
CSRF 토큰
시큐리티에서 CSRF 토큰 검사
정상적인 사용자(회원가입 페이지)인지 비정상적인 접근인지 구분
-Postman 등으로 정보입력할 수 있기 때문
http.csrf().disable();
CSRF 비활성화
Dto
728x90
반응형
LIST
'Spring Boot > 인스타그램 클론코딩' 카테고리의 다른 글
| 연관관계 개념 (0) | 2022.05.27 |
|---|---|
| 세션 정보, 시큐리티 태그 라이브러리 (0) | 2022.04.18 |
| 유효성 검사 (0) | 2022.04.07 |
| Spring Boot 쿼리스트링, 주소 변수 매핑, HTTP Header, HTTP 요청, 톰캣, JSP, Mustache, HTTP 상태코드 (0) | 2022.03.27 |
댓글