OAuth 2.0/JWT オーソライザーの例 - AWS Serverless Application Model

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

OAuth 2.0/JWT オーソライザーの例

API へのアクセスは、OpenID Connect (OIDC) および OAuth 2.0 フレームワークの一部として JWT を使用することによって制御できます。これを実行するには、HttpApiAuth データ型を使用します。

以下は 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 へのアクセスの制御」を参照してください。