Metode: delegate
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Panggilan ini menampilkan Token Web JSON (JWT) autentikasi baru yang memungkinkan entitas mengakses resource tertentu atas nama pengguna yang diautentikasi di JWT autentikasi asli. Digunakan untuk mendelegasikan
akses yang tercakup ke wrap atau
unwrap ke entitas lain saat
entitas tersebut perlu bertindak atas nama pengguna.
Permintaan HTTP
POST https://<base_url>/delegate
Ganti <base_url>
dengan URL Layanan Daftar Kontrol Akses Kunci (KACLS).
Parameter jalur
Tidak ada.
Isi permintaan
Isi permintaan berisi representasi JSON dari permintaan:
Representasi JSON |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
Kolom |
authentication |
string
JWT yang dikeluarkan oleh pihak ketiga yang menyatakan siapa pengguna tersebut. Lihat bagian autentikasi untuk mengetahui detailnya.
|
authorization |
string
JWT dengan klaim delegated_to dan resource_name yang menyatakan bahwa entitas yang diidentifikasi oleh klaim delegated_to diizinkan untuk mengakses resource_name atas nama pengguna. Untuk mengetahui informasi selengkapnya, lihat Token Otorisasi.
|
reason |
string (UTF-8)
String JSON passthrough yang memberikan konteks tambahan tentang operasi. JSON yang diberikan harus dibersihkan sebelum ditampilkan. Ukuran maks: 1 KB.
|
Langkah-langkah pemrosesan yang diperlukan
KACLS harus melakukan setidaknya langkah-langkah berikut:
- Validasi token otorisasi dan autentikasi. Untuk mengetahui informasi selengkapnya, lihat Token Otorisasi dan Token Autentikasi.
- Pastikan token otorisasi dan autentikasi adalah untuk pengguna yang sama.
Untuk mengetahui informasi selengkapnya, lihat
Mengenkripsi dan mendekripsi data.
- Pastikan klaim
kacls_url
di token otorisasi cocok dengan URL KACLS saat ini. Hal ini memungkinkan deteksi potensi server man-in-the-middle yang dikonfigurasi oleh orang dalam atau admin domain jahat.
- Jika klaim
kacls_owner_domain
ada di token otorisasi, periksa apakah nilai tersebut cocok dengan domain Google Workspace pemilik KACLS. Tindakan ini membantu mencegah pengguna yang tidak sah mendaftarkan KACLS Anda ke Google.
- Mencatat operasi, termasuk pengguna yang memulainya,
delegated_to
,
resource_name
, dan alasan yang diteruskan dalam permintaan.
- Buat, tandatangani, dan tampilkan token JWT yang berisi klaim
delegated_to
dan resource_name
dari token otorisasi.
KACLS gratis untuk melakukan pemeriksaan keamanan tambahan, termasuk yang berbasis klaim JWT.
Isi respons
Jika berhasil, metode ini akan menampilkan JWT autentikasi yang berisi klaim delegated_to
dan resource_name
. Token ini nantinya dapat digunakan untuk
autentikasi dalam panggilan ke metode Wrap dan Unwrap. Jika terjadi error, respons error terstruktur
harus ditampilkan.
Representasi JSON |
{
"delegated_authentication": string
}
|
Kolom |
delegated_authentication |
string
JWT autentikasi yang didelegasikan yang valid untuk mengakses resource_name oleh pengguna yang disebutkan dalam JWT autentikasi asli. Untuk mengetahui informasi selengkapnya, lihat Token autentikasi KACLS untuk delegate .
|
Contoh
Permintaan
POST https://mykacls.example.com/v1/delegate
{
"authentication": "eyJhbGciOi...",
"authorization": "eyJhbGciOi...delegated_to\":\"other_entity_id\",\"resource_name\":\"meeting_id\"...}",
"reason": "{client:'meet' op:'delegate_access'}"
}
Tanggapan
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],[],null,["# Method: delegate\n\nThis call returns a new authentication JSON Web Token (JWT) that allows\nan entity to access a specified resource on behalf of the user\nauthenticated in the original authentication JWT. It is used to delegate\nscoped access to [wrap](/workspace/cse/reference/wrap) or\n[unwrap](/workspace/cse/reference/unwrap) to another entity when that\nentity needs to act on behalf of the user.\n\n### HTTP request\n\n`POST https://\u003cbase_url\u003e/delegate`\n\nReplace `\u003cbase_url\u003e` with the Key Access Control List Service (KACLS) URL.\n\n### Path parameters\n\nNone.\n\n### Request body\n\nThe request body contains a JSON representation of the request:\n\n| JSON representation ||\n|---------------------------------------------------------------------------------|---|\n| ``` { \"authentication\": string, \"authorization\": string, \"reason\": string } ``` |\n\n| Fields ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `authentication` | `string` A JWT issued by a third-party asserting who the user is. See the authentication section for details. |\n| `authorization` | `string` A JWT with `delegated_to` and `resource_name` claims asserting that the entity identified by `delegated_to` claim is allowed to access `resource_name` on behalf of the user. For more information, see [Authorization Tokens](/workspace/cse/reference/authorization-tokens). |\n| `reason` | `string (UTF-8)` A passthrough JSON string providing additional context about the operation. The JSON provided should be sanitized before being displayed. Max size: 1 KB. |\n\n### Required processing steps\n\nThe KACLS must perform at least these steps:\n\n- Validate both authorization and authentication tokens. For more information, see [Authorization Tokens](/workspace/cse/reference/authorization-tokens) and [Authentication Tokens](/workspace/cse/reference/authentication-tokens).\n- Check that authorization and authentication tokens are for the same user. For more information, see [Encrypt and decrypt data](/workspace/cse/guides/encrypt-and-decrypt-data).\n- Check that the `kacls_url` claim in the authorization token matches the current KACLS URL. This allows detection of potential man-in-the-middle servers configured by insiders or rogue domain admins.\n- If the `kacls_owner_domain` claim exists in the authorization token, check that the value matches the KACLS owner's Google Workspace domain. This helps prevent unauthorized users from registering your KACLS with Google.\n- Log the operation, including the user originating it, the `delegated_to`, the `resource_name`, and the reason passed in the request.\n- Generate, sign, and return a JWT token containing `delegated_to` and `resource_name` claims from the authorization token.\n\nThe KACLS is free to perform additional security checks, including JWT claim\nbased ones.\n\n### Response body\n\nIf successful, this method returns an authentication JWT containing\n`delegated_to` and `resource_name` claims. This token can later be used for\nauthentication in calls to the Wrap and Unwrap methods. In case of an error, a\n[structured error reply](/workspace/cse/reference/structured-errors)\nshould be returned.\n\n| JSON representation ||\n|------------------------------------------------|---|\n| ``` { \"delegated_authentication\": string } ``` |\n\n| Fields ||\n|----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `delegated_authentication` | `string` A delegated authentication JWT valid for accessing `resource_name` by the user mentioned in the original authentication JWT. For more information, see [KACLS authentication token for `delegate`](/workspace/cse/reference/authentication-tokens#kacls_authentication_token_for_delegate). |\n\n### Example\n\n#### Request\n\n POST https://mykacls.example.com/v1/delegate\n {\n \"authentication\": \"eyJhbGciOi...\",\n \"authorization\": \"eyJhbGciOi...delegated_to\\\":\\\"other_entity_id\\\",\\\"resource_name\\\":\\\"meeting_id\\\"...}\",\n \"reason\": \"{client:'meet' op:'delegate_access'}\"\n }\n\n#### Response\n\n {\n \"delegated_authentication\": \"eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}\"\n }"]]