วิธีการ: delegate
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การเรียกนี้จะแสดง JSON Web Token (JWT) การตรวจสอบสิทธิ์ใหม่ที่อนุญาตให้
เอนทิตีเข้าถึงทรัพยากรที่ระบุในนามของผู้ใช้
ที่ได้รับการตรวจสอบสิทธิ์ใน JWT การตรวจสอบสิทธิ์เดิม ใช้เพื่อมอบสิทธิ์
การเข้าถึงที่กำหนดขอบเขตเพื่อห่อหรือ
แกะให้กับเอนทิตีอื่นเมื่อเอนทิตีนั้น
ต้องดำเนินการในนามของผู้ใช้
คำขอ HTTP
POST https://<base_url>/delegate
แทนที่ <base_url>
ด้วย URL ของบริการรายการควบคุมการเข้าถึงคีย์ (KACLS)
พารามิเตอร์เส้นทาง
ไม่มี
เนื้อความของคำขอ
เนื้อหาของคำขอมีการแสดงคำขอเป็น JSON ดังนี้
การแสดง JSON |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
ช่อง |
authentication |
string
JWT ที่ออกโดยบุคคลที่สามซึ่งยืนยันตัวตนของผู้ใช้ ดูรายละเอียดได้ที่ส่วนการตรวจสอบสิทธิ์
|
authorization |
string
JWT ที่มีคำกล่าวอ้าง delegated_to และ resource_name ซึ่งยืนยันว่าเอนทิตีที่ระบุโดยคำกล่าวอ้าง delegated_to ได้รับอนุญาตให้เข้าถึง resource_name ในนามของผู้ใช้ ดูข้อมูลเพิ่มเติมได้ที่โทเค็นการให้สิทธิ์
|
reason |
string (UTF-8)
สตริง JSON แบบส่งผ่านที่ให้บริบทเพิ่มเติมเกี่ยวกับการดำเนินการ ควรล้างข้อมูล JSON ที่ระบุก่อนแสดง ขนาดสูงสุด: 1 KB
|
ขั้นตอนการประมวลผลที่จำเป็น
KACLS ต้องดำเนินการอย่างน้อยตามขั้นตอนต่อไปนี้
- ตรวจสอบทั้งโทเค็นการให้สิทธิ์และโทเค็นการตรวจสอบสิทธิ์ ดูข้อมูลเพิ่มเติมได้ที่โทเค็นการให้สิทธิ์และโทเค็นการตรวจสอบสิทธิ์
- ตรวจสอบว่าโทเค็นการให้สิทธิ์และการตรวจสอบสิทธิ์เป็นของผู้ใช้รายเดียวกัน
ดูข้อมูลเพิ่มเติมได้ที่เข้ารหัสและถอดรหัสข้อมูล
- ตรวจสอบว่า
kacls_url
การอ้างสิทธิ์ในโทเค็นการให้สิทธิ์ตรงกับ
URL ของ KACLS ปัจจุบัน ซึ่งจะช่วยให้ตรวจพบเซิร์ฟเวอร์ที่อาจเป็นแบบ Man-in-the-Middle
ซึ่งกำหนดค่าโดยผู้ไม่หวังดีหรือผู้ดูแลโดเมนที่ไม่ซื่อสัตย์
- หากมีคำกล่าวอ้าง
kacls_owner_domain
ในโทเค็นการให้สิทธิ์ ให้ตรวจสอบ
ว่าค่าตรงกับโดเมน Google Workspace ของเจ้าของ KACLS ซึ่งจะช่วย
ป้องกันไม่ให้ผู้ใช้ที่ไม่ได้รับอนุญาตลงทะเบียน KACLS กับ Google
- บันทึกการดำเนินการ รวมถึงผู้ใช้ที่เริ่มการดำเนินการ
delegated_to
,
resource_name
และเหตุผลที่ส่งในคำขอ
- สร้าง ลงนาม และส่งคืนโทเค็น JWT ที่มีอ้างสิทธิ์
delegated_to
และ
resource_name
จากโทเค็นการให้สิทธิ์
KACLS สามารถทำการตรวจสอบความปลอดภัยเพิ่มเติมได้โดยไม่มีค่าใช้จ่าย ซึ่งรวมถึงการตรวจสอบที่อิงตามการอ้างสิทธิ์ JWT
เนื้อหาการตอบกลับ
หากสำเร็จ เมธอดนี้จะแสดงผล JWT การตรวจสอบสิทธิ์ที่มีการอ้างสิทธิ์ delegated_to
และ resource_name
คุณจะใช้โทเค็นนี้เพื่อ
การตรวจสอบสิทธิ์ในการเรียกเมธอด Wrap และ Unwrap ได้ในภายหลัง ในกรณีที่เกิดข้อผิดพลาด ควรแสดงผล
การตอบกลับข้อผิดพลาดที่มีโครงสร้าง
การแสดง JSON |
{
"delegated_authentication": string
}
|
ช่อง |
delegated_authentication |
string
JWT การตรวจสอบสิทธิ์ที่มอบสิทธิ์ซึ่งใช้ได้สำหรับการเข้าถึง resource_name โดยผู้ใช้ที่กล่าวถึงใน JWT การตรวจสอบสิทธิ์เดิม ดูข้อมูลเพิ่มเติมได้ที่โทเค็นการตรวจสอบสิทธิ์ KACLS สำหรับ delegate
|
ตัวอย่าง
ส่งคำขอ
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'}"
}
การตอบกลับ
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 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 }"]]