ご意見をお寄せいただきありがとうございました

この記事は機械翻訳されています.免責事項

API を使用して API セキュリティを管理する

API にアクセスして、API セキュリティを作成、設定、デプロイできます。

注:

API セキュリティ API を使用して機能を設定する方法については、 Nitro API のドキュメントを参照してください

手順 リソース URL
  1 API 定義の作成 https://adm.cloud.com/{customerid}/apisec/nitro/v1/config/apidefs
  2 API プロキシを追加 https://adm.cloud.com/apiproxies
  3 API プロキシを使用して API インスタンスをデプロイする https://adm.cloud.com/apiproxies/{customerid}/deployments
  4 API ポリシーを追加する https://adm.cloud.com/{customerid}/apisec/nitro/v1/config/policies/{id}

各API ポリシーには異なるconfig_specオブジェクトがあります。これは、policytypeに特定の値を設定するための JSON ディクショナリを含む不透明なオブジェクトです。

このオブジェクトでは、以下のオプションを使用して API リソースとそのメソッドを選択できます。

  • api-resource-paths -API 定義で定義されている API リソースパスとメソッドを指定します。

    { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": false, "put": false, "delete": false }
  • custom-rules -API 定義には存在しない可能性のあるカスタム API リソースパスとメソッドを指定します。

    { "endpoints": ["/pet/categories", "/pet/findByName"], "get": true, "post": false, "put": false, "delete": false }

この設定では、ポリシーは、指定した API リソースパスと一致する受信トラフィックリクエストをフィルタリングします。

各ポリシータイプのconfig_specについては、 ポリシータイプの API 例を参照してください

ポリシータイプの API 例

このセクションでは、サポートされている API ポリシータイプとその設定について説明します。

レート制限

Ratelimit ポリシータイプの設定例を以下に示します。 config_spec オブジェクトに次の設定を指定します。

{ "policytype": "Ratelimit", "config_spec": { "api-resource-paths": { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": false, "put": false, "delete": false }, "custom-rules": {}, "threshold": "10", "timeslice": "20000", "limittype": "BURSTY", "api-respondertype": "DROP", "header_name": "x-api-key", "per_client_ip": true }, "order_index": 1, "policy_name": "ratelimit_policy" }

各属性の詳細については、「 レート制限ポリシー」を参照してください。

OAuth

JWT Auth validation ポリシータイプの API 設定の例を以下に示します。 config_spec オブジェクトに次の設定を指定します。

{ "policytype": "JWT Auth Validation", "config_spec": { "api-resource-paths": { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": true, "put": false, "delete": false }, "custom-rules": {}, "jwks-uri": "https://uri.petstore.com", "issuer": "https://issuer.petstore.com", "audience": "petstore", "introspect-uri": "https://introspect.uri.com", "clientid": "client", "clientsecret": "clientsecret", "claims-to-save": ["scope", "scope2"], "allowed-algorithms": { "hs256": true, "rs256": true, "rs512": true } }, "order_index": 2, "policy_name": "Jwt_auth_policy" }

各属性の詳細については、「 OAuthポリシー」を参照してください。

ベーシック認証

BasicAuth ポリシータイプの API 設定の例を以下に示します。

{ "config_spec": { "api-resource-paths": { "delete": false, "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": true, "put": false }, "custom-rules": {} }, "order_index": 3, "policy_name": "Auth_BaSIC", "policytype": "BasicAuth" }

各属性の詳細については、「 基本認証ポリシー」を参照してください。

認証なし

NoAuth ポリシータイプの API 設定の例を以下に示します。

{ "config_spec": { "api-resource-paths": { "delete": false, "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": false, "put": false }, "custom-rules": {} }, "order_index": 4, "policy_name": "no_auth_policy", "policytype": "NoAuth" }

ボット

Bot ポリシータイプの API 設定の例を以下に示します。

{ "config_spec": { "api-resource-paths": { "delete": false, "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": false, "post": false, "put": false }, "bot-prof-name": "apisec_test_profile", "custom-rules": {} }, "order_index": 5, "policy_name": "bot_policy", "policytype": "Bot" }

各属性の詳細については、「 ボットポリシー」を参照してください。

WAF

WAF ポリシータイプの API 設定の例を以下に示します。

{ "config_spec": { "api-resource-paths": { "delete": false, "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": false, "post": false, "put": false }, "waf-prof-name": "apisec_waf_profile", "custom-rules": {} }, "order_index": 6, "policy_name": "waf_policy", "policytype": "WAF" }

各属性の詳細については、「 WAF ポリシー」を参照してください。

ヘッダー書き換え

以下は、Header RewriteポリシータイプのAPI構成の例です。 この構成をconfig_specオブジェクトに指定してください。

{ "policytype": "Header Rewrite", "config_spec": { "api-resource-paths": { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": true, "put": false, "delete": false }, "custom-rules": {}, "rewrite-policy-header-field-name": "org", "rewrite-policy-header-field-val": "Citrix", "rewrite-policy-header-field-new-val": "Citrite" }, "order_index": 7, "policy_name": "header_rewrite_pol" }

各属性の詳細については、「 ヘッダー書き換えポリシー」を参照してください。

URI パス書き換え

URI パス書き換えポリシータイプの API 設定の例を以下に示します。

{ "config_spec": { "api-resource-paths": { "endpoints": ["/store/order", "/store/inventory"], "delete": false, "get": true, "post": true, "patch": false, "put": false }, "custom-rules": { "delete": false, "endpoints": [], "get": false, "post": false, "patch": false, "put": true }, "path-rewrite-params": [ { "insert-segment-position": "beginning", "new-path-value": "v3", "old-path-value": "v2", "action-type": "replace path segment" }, { "insert-segment-position": "beginning", "new-path-value": "begin", "action-type": "insert path segment" }, { "insert-segment-position": "end", "new-path-value": "end", "action-type": "insert path segment" }, { "insert-segment-position": "before", "new-path-value": "before", "old-path-value": "store", "action-type": "insert path segment" }, { "insert-segment-position": "after", "new-path-value": "after", "old-path-value": "store", "action-type": "insert path segment" } ] }, "order_index": 24, "policy_name": "eats_uripathrewrite", "policytype": "URI Path Rewrite” }

各属性の詳細については、「 URI パス書き換えポリシー」を参照してください。

承認

Authorization ポリシータイプの API 設定の例を以下に示します。 config_spec オブジェクトに次の設定を指定します。

{ "policytype": "Authorization", "config_spec": { "api-resource-paths": { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": true, "put": false, "delete": false }, "custom-rules": {}, "claims": [{ "name": "scope", "values": ["value1", "value2"] }] }, "order_index": 8, "policy_name": "authorization" }

各属性の詳細については、「 承認ポリシー」を参照してください。

拒否

Deny ポリシータイプの API 設定の例を以下に示します。 config_spec オブジェクトに次の設定を指定します。

{ "policytype": "Deny", "config_spec": { "api-resource-paths": { "endpoints": ["/pet", "/pet/findByStatus", "/pet/findByTags"], "get": true, "post": true, "put": false, "delete": false }, "custom-rules": {}, "api-denytype": "RESPONDWITH" }, "order_index": 9, "policy_name": "deny_policy" }

api-denytypeでは 、次の値のいずれかを指定できます。

  • RESPONDWITH
  • RESET

各属性の詳細については、「 拒否ルール」を参照してください。

このコンテンツの正式なバージョンは英語で提供されています。Cloud Software Groupドキュメントのコンテンツの一部は、お客様の利便性のみを目的として機械翻訳されています。Cloud Software Groupは機械翻訳されたコンテンツを管理していないため、誤り、不正確な情報、不適切な用語が含まれる場合があります。英語の原文から他言語への翻訳について、精度、信頼性、適合性、正確性、またはお使いのCloud Software Group製品またはサービスと機械翻訳されたコンテンツとの整合性に関する保証、該当するライセンス契約書またはサービス利用規約、あるいはCloud Software Groupとのその他すべての契約に基づき提供される保証、および製品またはサービスのドキュメントとの一致に関する保証は、明示的か黙示的かを問わず、かかるドキュメントの機械翻訳された範囲には適用されないものとします。機械翻訳されたコンテンツの使用に起因する損害または問題について、Cloud Software Groupは責任を負わないものとします。
API を使用して API セキュリティを管理する

この記事の概要