LoginSignup
2

More than 5 years have passed since last update.

「組み込みメーカーならではのAWS Cognitoの使い方」というタイトルで AWS Dev Day 2018 LT大会で登壇しました。

Last updated at Posted at 2018-11-01

スクリーンショット 2018-11-01 20.29.32.png

前置き

LT大会に参加された方ありがとうございました。
いままで、Qiitaには大変お世話になっていたのですが、正しい情報を正しく伝える自信がなく
記事の投稿を躊躇していました。

今回のLT大会を通して少し自分に自身がついたのでこれを皮切りにどんどん記事をあげていこうと思いました。

本題

組み込みメーカーならではのAWS Cognitoの使い方

というタイトルでslideshareに登壇資料をアップしています。

みなさんのAWSの設計のサポートになればと幸いです。

補足

Lamabda拡張のドキュメントについて

資料の中には

スクリーンショット 2018-11-01 19.59.27.png

のようなイメージがあるのですが。

に記載があります。

SAMでの記載についての注意事項

全てサーバーレスで構築しているため、Serverless Application Model (AWS SAM)で記載できるのですが、ApiGatewayでLambdaオーサーライザーを指定する方法について記載されている記事がなかなかないようなので公開できる範囲で記載します。

Type: AWS::Serverless::Apiの中で


securityDefinitions:
  hoge-authorizer:
    type: apiKey
# AuthorizationにIDTokenを付加することを想定
    name: Authorization
    in: header
    x-amazon-apigateway-authtype: custom
    x-amazon-apigateway-authorizer:
      type: request
      identitySource: method.request.header.Authorization
      authorizerUri:
# Authorizerは認証を行うLambdaを指定
        !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${Authorizer.Arn}/invocations

のようにsecurityDefinitionsにAWSのswaggerの拡張で指定します。
これを

x-amazon-apigateway-integration:
  security:
    - hoge-authorizer: []

のように指定してカスタムセキュリティを指定します。

もし、需要があるようであればType: AWS::Serverless::ApiType: AWS::Serverless::FunctionでEventを使わないでAPIを定義する方法を記載したいと思います。

記事をご覧になっていただきありがとうございました。

  • swaggerの文法についてはこちら (英語記事ですがこれ以上良い資料を知らないです...)
  • swaggerのAWS拡張についてはこちらを確認ください

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2