روش: تفویض اختیار
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این فراخوان یک JSON Web Token (JWT) احراز هویت جدید را برمیگرداند که به یک نهاد اجازه میدهد به یک منبع مشخص از طرف کاربر احراز هویت شده در JWT احراز هویت اصلی دسترسی پیدا کند. هنگامی که آن موجودیت نیاز به اقدام از طرف کاربر دارد، از آن برای واگذاری دسترسی دامنهدار به wrap یا باز کردن به نهاد دیگری استفاده میشود.
درخواست 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 کیلوبایت |
مراحل پردازش مورد نیاز
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...}"
}
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[],[],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 }"]]