Halaman ini berlaku untuk Apigee, tetapi tidak untuk Apigee Hybrid.
Lihat dokumentasi
Apigee Edge.
Gunakan kebijakan VerifyIAM untuk menerapkan pemeriksaan otorisasi pada akses API, berdasarkan Google Cloud IAM. Kebijakan ini merupakan alternatif untuk kebijakan OAuthv2, dan kebijakan VerifyAPIKey. Untuk informasi tentang cara menyertakan VerifyIAM dalam solusi kontrol akses berbasis IAM, lihat Ringkasan autentikasi API berbasis IAM.
Kebijakan ini adalah Kebijakan standar dan dapat di-deploy ke jenis lingkungan apa pun. Untuk mengetahui informasi tentang jenis dan ketersediaan kebijakan dengan setiap jenis lingkungan, lihat Jenis kebijakan.
Referensi elemen
Referensi ini menunjukkan elemen dan atribut kebijakan VerifyIAM.
<VerifyIAM async="false" continueOnError="false" enabled="true" name="MyVerifyIAMPolicy"> <DisplayName>Custom label used in UI</DisplayName> <CredentialSource>flow_variable_name_containing_credential_value</CredentialSource> </VerifyIAM>
Atribut <VerifyIAM>
<VerifyIAM async="false" continueOnError="false" enabled="true" name="MyVerifyIAMPolicy">
Tabel berikut menjelaskan atribut yang umum untuk semua elemen induk kebijakan:
| Atribut | Deskripsi | Default | Kehadiran |
|---|---|---|---|
name |
Nama internal kebijakan. Nilai atribut Secara opsional, gunakan elemen |
T/A | Wajib |
continueOnError |
Tetapkan ke Tetapkan ke |
false | Opsional |
enabled |
Tetapkan ke Tetapkan ke |
benar | Opsional |
async |
Atribut ini tidak digunakan lagi. |
false | Tidak digunakan lagi |
Elemen <DisplayName>
Gunakan selain atribut name untuk melabeli kebijakan di editor proxy UI pengelolaan dengan nama bahasa alami yang berbeda.
<DisplayName>Policy Display Name</DisplayName>
| Default |
T/A Jika Anda menghapus elemen ini, nilai atribut |
|---|---|
| Kehadiran | Opsional |
| Jenis | String |
Elemen <CredentialSource>
<CredentialSource>flow_variable_name_containing_credential_value</CredentialSource>
Elemen ini menentukan variabel alur yang berisi nilai kredensial, dan memiliki karakteristik berikut:
- Biasanya, klien mengirim nilai dalam parameter kueri, header HTTP, atau parameter
formulir. String harus menentukan variabel alur yang sesuai dalam bentuk
request.queryparam.token. - Saat dibaca dari referensi, nilai langsung diharapkan. Misalnya, 'Bearer' tidak boleh ada sebagai awalan.
- Jika tidak disertakan, eksekusi kebijakan mengasumsikan nilai ada di header otorisasi dan dalam format standar "Bearer xyz".
| Default | T/A |
|---|---|
| Kehadiran | Opsional |
| Jenis | Variabel alur |
Contoh:
<VerifyIAM async="false" continueOnError="false" enabled="true" name="Verify-IAM-Permissions-1">
<DisplayName>VerifyIAM policy for flow 1</DisplayName>
<CredentialSource>request.queryparam.token</CredentialSource>
</VerifyIAM>Referensi error
This section describes the fault codes and error messages that are returned and fault variables that are set by Apigee 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.verifyiam.CredentialSourceRefUnresolved |
400 |
Flow variable provided inside credential source could not be resolved. |
steps.verifyiam.CredentialValueNotProvided |
400 |
Credential not found. If the credential source reference is not provided, we look at the default place like authorization header. |
steps.verifyiam.Forbidden |
403 |
Request could not be forwarded due to lack of sufficient permissions or missing access scopes or any other related issues. |
steps.verifyiam.MiscellaneousAuthorizationConfigurationError |
500 |
An issue with the authentication request to IAM. The API producer needs to fix this error based on details in the error response. |
steps.verifyiam.Unauthorized |
401 |
Problem with the credential, such as the value being invalid or expired. |
steps.verifyiam.UnexpectedAuthorizationInfrastructureError |
500 |
Internal error. |
Deployment errors
This policy does not return any policy-specific 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="Unauthorized" |
verifyiam.policy_name.failed |
policy_name is the user-specified name of the policy that threw the fault. | verifyiam.Verify-IAMToken.failed = true |