Methode: delegate
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dieser Aufruf gibt ein neues JSON Web Token (JWT) für die Authentifizierung zurück, mit dem eine Identität im Namen des Nutzers, der im ursprünglichen Authentifizierungs-JWT authentifiziert wurde, auf eine bestimmte Ressource zugreifen kann. Sie wird verwendet, um den Zugriff mit eingeschränktem Umfang auf wrap oder unwrap an eine andere Entität zu delegieren, wenn diese im Namen des Nutzers handeln muss.
HTTP-Anfrage
POST https://<base_url>/delegate
Ersetzen Sie <base_url>
durch die URL des Key Access Control List Service (KACLS).
Pfadparameter
Keine.
Anfragetext
Der Anfragetext enthält eine JSON-Darstellung der Anfrage:
JSON-Darstellung |
{
"authentication": string,
"authorization": string,
"reason": string
}
|
Felder |
authentication |
string
Ein von einem Drittanbieter ausgestelltes JWT, das angibt, wer der Nutzer ist. Weitere Informationen finden Sie im Abschnitt zur Authentifizierung.
|
authorization |
string
Ein JWT mit den Anforderungen delegated_to und resource_name , in denen bestätigt wird, dass die durch die Anforderung delegated_to identifizierte Entität im Namen des Nutzers auf resource_name zugreifen darf. Weitere Informationen finden Sie unter Autorisierungstokens.
|
reason |
string (UTF-8)
Ein Passthrough-JSON-String, der zusätzlichen Kontext zum Vorgang enthält. Das bereitgestellte JSON sollte bereinigt werden, bevor es angezeigt wird. Maximale Größe: 1 KB.
|
Erforderliche Verarbeitungsschritte
Der KACLS muss mindestens die folgenden Schritte ausführen:
- Sowohl Autorisierungs- als auch Authentifizierungstokens validieren Weitere Informationen finden Sie unter Autorisierungstokens und Authentifizierungstokens.
- Prüfen Sie, ob Autorisierungs- und Authentifizierungstokens für denselben Nutzer gelten.
Weitere Informationen finden Sie unter Daten verschlüsseln und entschlüsseln.
- Prüfen Sie, ob die Anforderung
kacls_url
im Autorisierungstoken mit der aktuellen KACLS-URL übereinstimmt. So können potenzielle Man-in-the-Middle-Server erkannt werden, die von Insidern oder betrügerischen Domainadministratoren konfiguriert wurden.
- Wenn der Anspruch
kacls_owner_domain
im Autorisierungstoken vorhanden ist, prüfen Sie, ob der Wert mit der Google Workspace-Domain des KACLS-Inhabers übereinstimmt. So wird verhindert, dass nicht autorisierte Nutzer Ihre KACLS bei Google registrieren.
- Protokolliere den Vorgang, einschließlich des Nutzers, der ihn initiiert hat, der
delegated_to
, der resource_name
und des in der Anfrage übergebenen Grunds.
- Generieren, signieren und geben Sie ein JWT-Token mit den Ansprüchen
delegated_to
und resource_name
aus dem Autorisierungstoken zurück.
Der KACLS kann zusätzliche Sicherheitsprüfungen durchführen, einschließlich JWT-Anspruchsprüfungen.
Antworttext
Bei Erfolg gibt diese Methode ein Authentifizierungs-JWT mit den Ansprüchen delegated_to
und resource_name
zurück. Dieses Token kann später zur Authentifizierung bei Aufrufen der Methoden „Wrap“ und „Unwrap“ verwendet werden. Im Fehlerfall sollte eine strukturierte Fehlerantwort zurückgegeben werden.
JSON-Darstellung |
{
"delegated_authentication": string
}
|
Felder |
delegated_authentication |
string
Ein delegiertes Authentifizierungs-JWT, das für den Zugriff auf resource_name durch den im ursprünglichen Authentifizierungs-JWT genannten Nutzer gültig ist. Weitere Informationen finden Sie unter KACLS-Authentifizierungstoken für delegate .
|
Beispiel
Anfrage
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'}"
}
Antwort
{
"delegated_authentication": "eyJhbGciOi...delegated_to_from_authz_token...resource_name_from_authz_token...}"
}
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 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 }"]]