# 인가 API - 권한 설정 및 표현식

### 선언적 방식

* URL방식
  * http.antMatcher("/user/\*\*").hasRole("User")
* &#x20;Method
  * @PreAuthrized("hasRole('USER')")
  * public void user(){sout('user')}

### 동적 방식 - DB 연동 프로그래밍

* URL
* Method

### &#x20;URL 방식

![](https://15316191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7_opr2RFh9Acog0_8H%2F-MIcUFK1y-cCNDQQebO-%2F-MIcVPtg637yLmB6jkld%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202020-10-02%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%205.50.23.png?alt=media\&token=e4da1ae0-9298-4e37-a235-16b512a452d6)

## 표현식

![](https://15316191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7_opr2RFh9Acog0_8H%2F-MIcUFK1y-cCNDQQebO-%2F-MIcXyqnKUxNs3a_Wggd%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202020-10-02%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%206.01.36.png?alt=media\&token=63cf1091-39b9-4268-b9c5-15e95c3a826c)

