<aside> 💡 220214

</aside>

403 ERROR

@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class
SecurityConfig extends WebSecurityConfigurerAdapter {
		...
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        **http.csrf().disable();**

        http
            .authorizeRequests()
            .antMatchers("/api/v1/auth/**","/", **"/api/v1/ggultip/*"**,
                    "/v2/api-docs", "/swagger-resources/**", "/swagger-ui/index.html", "/swagger-ui.html","/webjars/**", "/swagger/**",   // swagger
                    "/h2-console/**",
                    "/favicon.ico").permitAll()
            .anyRequest().authenticated();  // 나머지 API 는 전부 인증 필요
			...
    }
}

[Spring Security] 스프링 시큐리티 403 Forbidden 에러

Enum 값

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum GgultipCategoryType {

    ALL("전체"),
    CELEBRITY("연예인"),
    STYLING("스타일링"),
    EVENT("이벤트");

    private final String category;
}

스터디할래 - 11주차 과제: Enum

enum 사용하기

Message “can’t parse JSON. Raw result”

static List<GgultipContentResponse> getContentResponses(Ggultip ggultip){
    **JSONArray jsonArray = new JSONArray();**
    for(GgultipContent ggultipContent: ggultip.getContents()){
        jsonArray.add(GgultipContentResponse.of(ggultipContent));
    }
    return jsonArray;
}

SpringBoot로 JSON 응답 보내는 방법 (GSON JsonObject, @ResponseBody, @RestController)

JAVA에서 JSON 데이터 만들기