機械翻訳について

APIキー・ベース認証

APIキーで保護されたREST APIの呼出しをサポートするには、API Key Based Authentication管理対象セキュリティ・ポリシーを使用します。

概要

APIキー・ベース認証ポリシーをドキュメントに追加するには、使用可能な認証スキーム・テンプレートを使用します。 「新規接続定義の実装」を参照してください。

接続定義に必要なセキュリティ・ポリシーをカスタマイズできます。

セキュリティ・プロパティ

このセキュリティ・ポリシーを使用する接続定義は、securityPropertiesセクションで次のプロパティを定義します。 「接続プロパティおよびサンプル・コード」を参照してください。

name, displayName, shortDescription列およびdescription列の値は、アダプタ定義ドキュメントにセキュリティ・ポリシーを挿入したときに表示されるデフォルト値を示します。 これらの値は、必要に応じて更新できます。

name displayName shortDescription description データ型 必須

accessToken

API Key

Generated API key.

Generated API Key used to identify the client that is making the request.

パスワード

はい

accessTokenUsage

API Key Usage

Default: -H Authorization: Bearer ${api-key}

URI syntax to show how the API key is passed to access a protected resource.

To pass the API key as a query parameter, specify the following value as a query parameter: "?<query-param-name>=${api-key}"

To pass the API key as a header, specify the following value: "-H Authorization: Bearer ${api-key}"

テキスト

いいえ

サンプル・コード: APIキー・ベースの認証

次のコード・サンプルは、APIキー・ベースの認証を使用して接続でセキュリティ・ポリシーを定義する方法を示しています。

"securityPolicies": [
   {
     "type": "managed",
     "policy": "API_KEY_AUTHENTICATION",
     "description": "API Key Based Authentication",
     "displayName": "API Key Based Authentication",
     "scope": "ACTION",
     "securityProperties": [
       {
         "name": "accessToken",
         "displayName": "API Key",
         "description": "Provide the API Key",
         "shortDescription": "Example: <The generated api key>",
         "hidden": false,
         "required": true
       },
       {
         "name": "accessTokenUsage",
         "hidden": true,
         "required": true,
         "default": "-H Authorization: Bearer ${api-key}"
       }
     ]
   }
]