DCAMP FRONTEND API 개발 가이드 » 이력 » 버전 1
최시은, 2023-05-25 06:32
| 1 | 1 | 최시은 | h2. DCAMP FRONTEND API 개발 가이드 |
|---|---|---|---|
| 2 | |||
| 3 | 1. SecurityConfig 설정(security/congif/SecurityConfig.java) |
||
| 4 | * securityFilterChain 메소드 - 개발 진행할 URL 에 대한 hasAuthority 룰 추가 |
||
| 5 | <pre><code class="java"> |
||
| 6 | http.csrf().disable() |
||
| 7 | .authorizeHttpRequests((authorize) -> |
||
| 8 | authorize |
||
| 9 | // hasAuthority 사용: db에 ROLE_ 안붙여도 됨 |
||
| 10 | .requestMatchers("/test/admin").hasAuthority("ADMIN") |
||
| 11 | .requestMatchers("/test/user").hasAuthority("USER") |
||
| 12 | .requestMatchers("/projects/**").hasAuthority("ADMIN") |
||
| 13 | .anyRequest().authenticated() |
||
| 14 | </code></pre> |