

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 에 대한 OAuth 2.0/JWT 권한 부여자 예제 AWS SAM
<a name="serverless-controlling-access-to-apis-oauth2-authorizer"></a>

JWT를 [OpenID Connect (OIDC)](https://openid.net/specs/openid-connect-core-1_0.html) 및 [OAuth 2.0](https://oauth.net/2/) 프레임워크의 일부로 사용하여 API에 대한 액세스를 제어할 수 있습니다. 이 작업을 수행하려면 [HttpApiAuth](sam-property-httpapi-httpapiauth.md) 데이터 유형을 사용합니다. 

다음은 OAuth 2.0/JWT 권한 부여자에 대한 예제 AWS SAM 템플릿 섹션입니다.

```
Resources:
  MyApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      Auth:
        Authorizers:
          MyOauth2Authorizer:
            AuthorizationScopes:
              - scope
            IdentitySource: $request.header.Authorization
            JwtConfiguration:
              audience:
                - audience1
                - audience2
              issuer: "https://www.example.com/v1/connect/oidc"
        DefaultAuthorizer: MyOauth2Authorizer
      StageName: Prod
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./src
      Events:
        GetRoot:
          Properties:
            ApiId: MyApi
            Method: get
            Path: /
            PayloadFormatVersion: "2.0"
          Type: HttpApi
      Handler: index.handler
      Runtime: nodejs12.x
```

OAuth 2.0/JWT 권한 부여자에 대한 자세한 내용은 *API Gateway 개발자 가이드*에서 [JWT 권한 부여자를 사용하는 HTTP API에 대한 액세스 제어](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html)를 참조하세요.