Metoda: delegate
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
To wywołanie zwraca nowy token internetowy JSON (JWT) uwierzytelniania, który umożliwia podmiotowi dostęp do określonego zasobu w imieniu użytkownika uwierzytelnionego w oryginalnym tokenie JWT uwierzytelniania. Służy do przekazywania zawężonego dostępu do zawijania lub odwijania innemu podmiotowi, gdy musi on działać w imieniu użytkownika.
Żądanie HTTP
POST https://<base_url>/delegate
Zastąp symbol <base_url>
adresem URL usługi listy kontroli dostępu do kluczy (KACLS).
Parametry ścieżki
Brak.
Treść żądania
Treść żądania zawiera reprezentację żądania w formacie JSON:
Zapis JSON |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
Pola |
authentication |
string
Token JWT wydany przez firmę zewnętrzną, który potwierdza tożsamość użytkownika. Więcej informacji znajdziesz w sekcji dotyczącej uwierzytelniania.
|
authorization |
string
Token JWT z deklaracjami delegated_to i resource_name , które potwierdzają, że podmiot zidentyfikowany przez deklarację delegated_to ma uprawnienia do dostępu do resource_name w imieniu użytkownika. Więcej informacji znajdziesz w artykule Tokeny autoryzacji.
|
reason |
string (UTF-8)
Ciąg JSON przekazywany dalej, który zawiera dodatkowy kontekst dotyczący operacji. Przed wyświetleniem podany kod JSON należy oczyścić. Maksymalny rozmiar: 1 KB.
|
Wymagane czynności przetwarzania
KACLS musi wykonać co najmniej te czynności:
- Sprawdź zarówno token autoryzacji, jak i token uwierzytelniania. Więcej informacji znajdziesz w sekcjach Tokeny autoryzacji i Tokeny uwierzytelniania.
- Sprawdź, czy tokeny autoryzacji i uwierzytelniania dotyczą tego samego użytkownika.
Więcej informacji znajdziesz w artykule Szyfrowanie i odszyfrowywanie danych.
- Sprawdź, czy roszczenie
kacls_url
w tokenie autoryzacji jest zgodne z bieżącym adresem URL usługi KACLS. Umożliwia to wykrywanie potencjalnych serwerów typu „man-in-the-middle” skonfigurowanych przez osoby z wewnątrz organizacji lub nieuczciwych administratorów domen.
- Jeśli w tokenie autoryzacji istnieje roszczenie
kacls_owner_domain
, sprawdź, czy jego wartość jest zgodna z domeną Google Workspace właściciela KACLS. Pomaga to zapobiegać rejestrowaniu Twojego systemu KACLS w Google przez nieautoryzowanych użytkowników.
- Zarejestruj operację, w tym użytkownika, który ją zainicjował,
delegated_to
, resource_name
i przyczynę przekazaną w żądaniu.
- Wygeneruj, podpisz i zwróć token JWT zawierający roszczenia
delegated_to
i resource_name
z tokena autoryzacji.
KACLS może przeprowadzać dodatkowe kontrole bezpieczeństwa, w tym kontrole oparte na roszczeniach JWT.
Treść odpowiedzi
Jeśli operacja się uda, ta metoda zwróci token JWT uwierzytelniania zawierający roszczenia delegated_to
i resource_name
. Ten token może być później używany do uwierzytelniania w wywołaniach metod Wrap i Unwrap. W przypadku błędu należy zwrócić odpowiedź z błędem strukturalnym.
Zapis JSON |
{
"delegated_authentication": string
}
|
Pola |
delegated_authentication |
string
Token JWT uwierzytelniania delegowanego, który jest ważny w przypadku dostępu do resource_name przez użytkownika wymienionego w oryginalnym tokenie JWT uwierzytelniania. Więcej informacji znajdziesz w artykule Token uwierzytelniania KACLS dla delegate .
|
Przykład
Żądanie
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'}"
}
Odpowiedź
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 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 }"]]