<aside> 💡 220214
</aside>
@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 에러
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum GgultipCategoryType {
ALL("전체"),
CELEBRITY("연예인"),
STYLING("스타일링"),
EVENT("이벤트");
private final String category;
}
enum 사용하기
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)