TROUBLESHOOTING
[TROUBLESHOOTING] 403 ERROR ON USER RESISTRATION
thovy
2022. 10. 21. 16:47
728x90
λ°μν
SMALL
ERROR β
π€·ββοΈ?
USER λ₯Ό REGIST νλ €νλ©΄ 403 ERROR κ° λ¬λ€.
μλ μμ§ μ무κ²λ μ λ§λ€κ³ κΆνμ΄λΌλ κ² μλ USER μ 403 ERROR
???
ROLE μ μμ§ μ λ§λ€μλλ°?
πββοΈ!!
μν! λλ Security
λ₯Ό μ¬μ©νμ§ !
μνΈνλ₯Ό μν΄ BCryptPasswordEncoder
λ μ¬μ©νμ§!
SOLUTION β
// SecurityConfig.java
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@Override
β protected void configure(HttpSecurity http) throws Exception{
http
.authorizeHttpRequests()
.antMatchers("/api/**")
.permitAll();
}
///////////////////////////////////////////////////////
@Override
β
protected void configure(HttpSecurity http) throws Exception{
http
.csrf().disable()
.authorizeHttpRequests()
.antMatchers("/api/**")
.permitAll();
}
}
.csrf().disable()
ββ
CAUTION
ββ
κ·Έλ λ€κ³ 무μμ csrf
λ₯Όdisable
λ‘ νλ©΄ μ λλ€.
λλ νΌμ μΉμ¬μ΄νΈλ₯Ό λ§λ€κ³ μλ κ±°κΈ° λλ¬Έμ μ΄λ κ² μ¬μ©νμ§λ§, λμ€μ token
μ μ¬μ©νλ€λκ° λ€λ₯Έ λ°©λ²μΌλ‘ csrf
λ₯Ό μμ ν΄μΌ νλ€.
λ
γ γ μ΄μ 500 μλ¬λ€ γ γ γ γ γ γ
π
728x90
λ°μν
LIST