概要
指定された OAuth V2 認可コードまたはアクセス トークンを削除します。
サンプル
アクセス トークンの削除
以下に、OAuth 2.0 アクセス トークンを削除するポリシーの例を示します。この例では、リクエスト メッセージ上で削除するアクセス トークンを見つけるために、access_token という名前のヘッダーを検索します。
<DeleteOAuthV2Info name="DeleteAccessToken">
<AccessToken ref="request.header.access_token"></AccessToken>
</DeleteOAuthV2Info>認可コードの削除
以下に、OAuth 2.0 の認可コードを削除するポリシーの例を示します。この例では、リクエスト メッセージ上で認可コードを見つけるために、code という名前のクエリ パラメータを検索します。
<DeleteOAuthV2Info name="DeleteAuthCode">
<AuthorizationCode ref="request.queryparam.code"></AuthorizationCode>
</DeleteOAuthV2Info>要素リファレンス
この要素リファレンスでは、DeleteOAuthV2Info ポリシーの要素と属性について説明します。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DeleteOAuthV2Info async="false" continueOnError="false" enabled="true" name="DeleteOAuthV2Info-1"> <DisplayName>Delete OAuth v2.0 Info 1</DisplayName> <AccessToken ref={some-variable}></AccessToken> <!--<AuthorizationCode ref={some-variable}></AuthorizationCode>--> <Attributes/> </DeleteOAuthV2Info
<DeleteOAuthV2Info> 属性
<DeleteOAuthV2Info async="false" continueOnError="false" enabled="true" name="Delete-OAuth-v20-Info-1">
| 属性 | 説明 | デフォルト | 要否 |
|---|---|---|---|
| async |
リクエスト / レスポンス フローを処理するプールとは異なるスレッドプールでポリシーを実行するように指定するには、 この設定は、内部最適化にのみ使用されます。 |
false | 省略可 |
| continueOnError |
多くの場合、障害の発生時にポリシーがエラーを返すように設定します。この属性を |
false | 省略可 |
| enabled | ポリシーを適用するかどうかを設定します。false に設定すると、ポリシーは「オフ」になり、適用されません(ポリシーはフローに接続されたままになります)。 |
true | 省略可 |
| name |
ポリシーの内部名。この名前は、ポリシーをフローに接続するときに Step 要素で参照されます。 注: 名前に使用できる文字は、 |
なし | 必須 |
<AccessToken> 要素
削除するアクセス トークンが格納されている変数を指定します。たとえば、アクセス トークンが 「access_token」というクエリ パラメータとしてリクエスト メッセージに接続されている場合は、request.queryparam.access_token を指定します。トークンを参照する有効な変数を使用できます。まれなケースですが、リテラル トークン文字列を渡すこともできます。
<AccessToken ref="request.queryparam.access_token"></AccessToken>
| デフォルト: | なし |
| 要否: | <AccessToken> または <AuthorizationCode> が必須です。 |
| 型: | 文字列 |
属性
| 属性 | 説明 | デフォルト | 要否 |
|---|---|---|---|
| ref |
アクセス トークン変数。通常、フロー変数から取得します。たとえば、 |
なし | 省略可 |
<AuthorizationCode> 要素
削除する認可コードが格納されている変数を指定します。たとえば、認可コードが 「code」というクエリ パラメータとしてリクエスト メッセージに添付されている場合は、request.queryparam.code を指定します。トークンを参照する有効な変数を使用できます。まれなケースですが、リテラル トークン文字列を渡すこともできます。
<AccessToken ref="request.queryparam.access_token"></AccessToken>
| デフォルト: | なし |
| 要否: | <AccessToken> または <AuthorizationCode> が必須です。 |
| 型: | 文字列 |
属性
| 属性 | 説明 | デフォルト | 要否 |
|---|---|---|---|
| ref |
アクセス トークン変数。通常、フロー変数から取得します。たとえば、 |
なし | 省略可 |
<DisplayName> 要素
管理 UI のプロキシ エディタでポリシーに設定する自然言語のラベル名です。省略すると、ポリシーの name 属性が使用されます。
<DisplayName>DeleteOAuthV2Info 1</DisplayName>
| デフォルト: | ポリシーの name 属性の値。 |
| 要否: | 省略可 |
| 型: | String |
エラー リファレンス
This section describes the fault codes and error messages that are returned and fault variables that are set by Edge when this policy triggers an error. This information is important to know if you are developing fault rules to handle faults. To learn more, see What you need to know about policy errors and Handling faults.
Runtime errors
These errors can occur when the policy executes.
| Fault code | HTTP status | Cause |
|---|---|---|
steps.oauth.v2.invalid_access_token |
401 | The access token sent to the policy is invalid. |
steps.oauth.v2.invalid_request-authorization_code_invalid |
401 | The authorization code sent to the policy is invalid. |
steps.oauth.v2.InvalidAPICallAsNoApiProductMatchFound |
401 | Please see this Apigee Community post for information about troubleshooting this error. |
Deployment errors
Refer to the message reported in the UI for information about deployment errors.
Fault variables
These variables are set when this policy triggers an error at runtime.
| Variables | Where | Example |
|---|---|---|
fault.name="fault_name" |
fault_name is the name of the fault, as listed in the Runtime errors table above. The fault name is the last part of the fault code. | fault.name = "invalid_access_token" |
oauthV2.policy_name.failed |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.failed = true |
oauthV2.policy_name.fault.name |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.fault.name = invalid_access_token |
oauthv2.policy_name.fault.cause |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.cause = Invalid Access Token |
Example error response
{
"fault": {
"faultstring": "Invalid Access Token",
"detail": {
"errorcode": "keymanagement.service.invalid_access_token"
}
}
}Example fault rule
<faultrule name="VariableOfNonMsgType"></faultrule><FaultRule name="DeleteOAuthV2Info_Faults">
<Step>
<Name>AM-InvalidTokenResponse</Name>
</Step>
<Condition>(fault.name = "invalid_access_token")</Condition>
</FaultRule>スキーマ
各ポリシータイプは XML スキーマ(.xsd)によって定義されます。ポリシー スキーマは GitHub から入手できます。