Méthode : delegate
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cet appel renvoie un nouveau jeton Web JSON (JWT) d'authentification qui permet à une entité d'accéder à une ressource spécifiée au nom de l'utilisateur authentifié dans le jeton JWT d'authentification d'origine. Il est utilisé pour déléguer un accès limité à wrap ou unwrap à une autre entité lorsque celle-ci doit agir au nom de l'utilisateur.
Requête HTTP
POST https://<base_url>/delegate
Remplacez <base_url>
par l'URL du service de liste de contrôle d'accès aux clés (KACLS).
Paramètres de chemin d'accès
Aucune.
Corps de la requête
Le corps de la requête contient une représentation JSON de la requête :
Représentation JSON |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
Champs |
authentication |
string
Jeton JWT émis par un tiers pour affirmer l'identité de l'utilisateur. Pour en savoir plus, consultez la section sur l'authentification.
|
authorization |
string
Jeton JWT avec les revendications delegated_to et resource_name indiquant que l'entité identifiée par la revendication delegated_to est autorisée à accéder à resource_name au nom de l'utilisateur. Pour en savoir plus, consultez Jetons d'autorisation.
|
reason |
string (UTF-8)
Chaîne JSON directe fournissant un contexte supplémentaire sur l'opération. Le JSON fourni doit être nettoyé avant d'être affiché. Taille maximale : 1 Ko.
|
Étapes de traitement requises
Le KACLS doit au moins effectuer les étapes suivantes :
- Validez les jetons d'autorisation et d'authentification. Pour en savoir plus, consultez Jetons d'autorisation et Jetons d'authentification.
- Vérifiez que les jetons d'autorisation et d'authentification sont destinés au même utilisateur.
Pour en savoir plus, consultez Chiffrer et déchiffrer des données.
- Vérifiez que la revendication
kacls_url
du jeton d'autorisation correspond à l'URL KACLS actuelle. Cela permet de détecter les serveurs potentiels d'attaque de l'homme du milieu configurés par des personnes internes ou des administrateurs de domaine malveillants.
- Si la revendication
kacls_owner_domain
existe dans le jeton d'autorisation, vérifiez que la valeur correspond au domaine Google Workspace du propriétaire de KACLS. Cela permet d'empêcher les utilisateurs non autorisés d'enregistrer votre KACLS auprès de Google.
- Consignez l'opération, y compris l'utilisateur à l'origine de l'opération, le
delegated_to
, le resource_name
et le motif transmis dans la requête.
- Générez, signez et renvoyez un jeton JWT contenant les revendications
delegated_to
et resource_name
du jeton d'autorisation.
Le KACLS est libre d'effectuer des vérifications de sécurité supplémentaires, y compris celles basées sur les revendications JWT.
Corps de la réponse
En cas de succès, cette méthode renvoie un jeton JWT d'authentification contenant les revendications delegated_to
et resource_name
. Ce jeton pourra ensuite être utilisé pour l'authentification dans les appels aux méthodes Wrap et Unwrap. En cas d'erreur, une réponse d'erreur structurée doit être renvoyée.
Représentation JSON |
{
"delegated_authentication": string
}
|
Champs |
delegated_authentication |
string
Jeton JWT d'authentification déléguée valide pour accéder à resource_name par l'utilisateur mentionné dans le jeton JWT d'authentification d'origine. Pour en savoir plus, consultez Jeton d'authentification KACLS pour delegate .
|
Exemple
Requête
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'}"
}
Réponse
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 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 }"]]