Authorizerの作成

Prev Next

Classic/VPC環境で利用できます。

API使用時の認証方法として使用可能な Authorizerを作成します。

リクエスト

リクエスト形式を説明します。リクエスト形式は次の通りです。

メソッド URI
POST /authorizers

リクエストヘッダ

API Gatewayで共通して使用されるヘッダの詳細は、API Gatewayのリクエストヘッダをご参照ください。

リクエスト構文

リクエスト構文は次の通りです。

{
  "authorizerName" : "authorizerName",
  "authorizerConfig" : {
    "functionId" : "functionId",
    "payload" : [ {
      "in" : "HEADER",
      "name" : "name"
    } ],
    "region" : "region"
  },
  "authorizerType" : "CLOUD_FUNCTIONS",
  "authorizerDescription" : "authorizerDescription"
}

リクエストボディ

リクエストボディの説明は次の通りです。

フィールド タイプ 必須の有無 説明
authorizerName String Required 作成する Authorizer名
  • 英数字、記号の「-」、「_」を使用して1~20文字以内で入力
authorizerConfig Object Required 作成する Authorizerの構成情報
authorizerConfig.functionId String Required 作成する Authorizerでサポートするサービス(タイプ)の Function名
  • <例> Cloud Functionsサービスの Action名
authorizerConfig.payload[] String Required 認証処理のために Authorizerに渡すためのリクエストタイプ(ヘッダまたはクエリ文字列)を選択し、変数名を入力
authorizerConfig.payload[].in String Required 指定する Payloadタイプ
  • HEADER | QUERY STRING
    • HEADER: ヘッダ
    • QUERY STRING: クエリ文字列
authorizerConfig.payload[].name String Required Payload変数名
authorizerConfig.region String Required 作成する Authorizerのサポートサービス(タイプ)がある地域を選択
authorizerType String Required Authorizerのサポートサービス(タイプ)を選択
authorizerDescription String Optional 作成する Authorizerの説明を入力
  • 0~300文字

リクエスト例

リクエストのサンプルコードは次の通りです。

curl -X POST 'https://apigateway.apigw.ntruss.com/api/v1/authorizers' \
--header 'Content-Type: application/json' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'
--data '{
  "authorizerName" : "author-***",
  "authorizerConfig" : {
    "functionId" : "functionId",
    "payload" : [ {
      "in" : "HEADER",
      "name" : "payload-***"
    } ],
    "region" : "region"
  },
  "authorizerType" : "CLOUD_FUNCTIONS",
  "authorizerDescription" : "authorizer-*** Description"
}'

レスポンス

レスポンス形式を説明します。

レスポンス構文

構文は次の通りです。

{
    "authorizerId": "authorizerId",
    "tenantId": "tenantId",
    "authorizerName": "authorizerName",
    "authorizerDescription": "authorizerDescription",
    "authorizerType": "authorizerType",
    "authorizerConfig": {
        "region": "region",
        "functionId": "functionId",
        "payload": [
            {
                "in": "in",
                "name": "name"
            }
        ]
    },
    "modifier": "modifier",
    "domainCode": "domainCode",
    "modTime": "2024-05-03T01:26:57Z"
}

レスポンスステータスコード

API Gatewayで共通して使用されるレスポンスステータスコードの詳細は、API Gatewayのレスポンスステータスコードをご参照ください。

レスポンス例

レスポンスのサンプルコードは次の通りです。

{
    "authorizerId": "***yddjd2m",
    "tenantId": "***4402f55ae4436913a6e2c65bab47c",
    "authorizerName": "authorizer-***",
    "authorizerDescription": "authorizer-*** Description",
    "authorizerType": "CLOUD_FUNCTIONS",
    "authorizerConfig": {
        "region": "KR",
        "functionId": "***/***",
        "payload": [
            {
                "in": "HEADER",
                "name": "payload-***"
            }
        ]
    },
    "modifier": "d12c9fd0-****-****-****-246e96591a38",
    "domainCode": "PUB",
    "modTime": "2024-05-03T01:26:57Z"
}