Project

일반

사용자정보

Actions

DCAMP FRONTEND API 개발 가이드 » 이력 » 개정판 1

개정판 1/31 | 다음 »
최시은, 2023-05-25 06:32


DCAMP FRONTEND API 개발 가이드

1. SecurityConfig 설정(security/congif/SecurityConfig.java)
  • securityFilterChain 메소드 - 개발 진행할 URL 에 대한 hasAuthority 룰 추가
    http.csrf().disable()
         .authorizeHttpRequests((authorize) ->
                                    authorize
                                            // hasAuthority 사용: db에 ROLE_ 안붙여도 됨
                                            .requestMatchers("/test/admin").hasAuthority("ADMIN")
                                            .requestMatchers("/test/user").hasAuthority("USER")
                                            .requestMatchers("/projects/**").hasAuthority("ADMIN")
                                            .anyRequest().authenticated()
    

최시은이(가) 약 2년 전에 변경 · 1 revisions