Método: delegate
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Esta llamada devuelve un nuevo token web JSON (JWT) de autenticación que permite que una entidad acceda a un recurso especificado en nombre del usuario autenticado en el JWT de autenticación original. Se usa para delegar el acceso con alcance a wrap o unwrap a otra entidad cuando esta necesita actuar en nombre del usuario.
Solicitud HTTP
POST https://<base_url>/delegate
Reemplaza <base_url>
por la URL del servicio de lista de control de acceso a las claves (KACLS).
Parámetros de ruta
Ninguno
Cuerpo de la solicitud
El cuerpo de la solicitud contiene una representación JSON de la solicitud:
Representación JSON |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
Campos |
authentication |
string
Es un JWT emitido por un tercero que afirma quién es el usuario. Consulta la sección de autenticación para obtener más detalles.
|
authorization |
string
Un JWT con las reclamaciones delegated_to y resource_name que confirman que la entidad identificada por la reclamación delegated_to puede acceder a resource_name en nombre del usuario. Para obtener más información, consulta Tokens de autorización.
|
reason |
string (UTF-8)
Es una cadena JSON de transferencia que proporciona contexto adicional sobre la operación. El JSON proporcionado debe limpiarse antes de mostrarse. Tamaño máx.: 1 KB
|
Pasos de procesamiento obligatorios
El KACLS debe realizar, al menos, estos pasos:
- Valida los tokens de autorización y autenticación. Para obtener más información, consulta Tokens de autorización y Tokens de autenticación.
- Verifica que los tokens de autorización y autenticación sean para el mismo usuario.
Para obtener más información, consulta Encripta y desencripta datos.
- Verifica que el reclamo
kacls_url
en el token de autorización coincida con la URL actual de KACLS. Esto permite detectar posibles servidores de intermediarios configurados por personas internas o administradores de dominios no autorizados.
- Si el reclamo
kacls_owner_domain
existe en el token de autorización, verifica que el valor coincida con el dominio de Google Workspace del propietario del KACLS. Esto ayuda a evitar que usuarios no autorizados registren tu KACLS en Google.
- Registra la operación, incluido el usuario que la originó, el
delegated_to
, el resource_name
y el motivo que se pasó en la solicitud.
- Genera, firma y devuelve un token JWT que contiene las reclamaciones
delegated_to
y resource_name
del token de autorización.
El KACLS es gratuito para realizar verificaciones de seguridad adicionales, incluidas las basadas en reclamos de JWT.
Cuerpo de la respuesta
Si la operación se realiza correctamente, este método devuelve un JWT de autenticación que contiene las declaraciones delegated_to
y resource_name
. Este token se puede usar más adelante para la autenticación en las llamadas a los métodos Wrap y Unwrap. En caso de error, se debe devolver una respuesta de error estructurada.
Representación JSON |
{
"delegated_authentication": string
}
|
Campos |
delegated_authentication |
string
Es un JWT de autenticación delegada válido para acceder a resource_name por el usuario mencionado en el JWT de autenticación original. Para obtener más información, consulta Token de autenticación de KACLS para delegate .
|
Ejemplo
Solicitud
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'}"
}
Respuesta
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 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 }"]]