Auf dieser Seite wird beschrieben, wie Cloud de Confiance by S3NS Administratoren Organisationsbeschränkungen testen können, ohne einen Ausgehende-Proxy konfigurieren zu müssen.
So erstellen und testen Sie den Abschnitt zu organisatorischen Einschränkungen:
- Verwenden Sie den Befehl - gcloud organizations list, um die Cloud de Confiance by S3NS Organisations-ID der Organisation abzurufen:- gcloud organizations list- Die Beispielausgabe sieht so aus: - DISPLAY_NAME: Organization A ID: 123456789 DIRECTORY_CUSTOMER_ID: a1b2c3d4
- Nachdem du die Organisations-ID abgerufen hast, erstellst du die JSON-Darstellung für den Headerwert im folgenden Format: - { "resources": ["organizations/123456789"], "options": "strict" }
- Codieren Sie den Wert für den Anfrageheader gemäß den Spezifikationen in RFC 4648 Abschnitt 5. - Wenn die JSON-Darstellung für den Headerwert beispielsweise in der Datei - authorized_orgs.jsongespeichert ist, sieht die Codierung mit basenc so aus:- $ OR_HEADER=`cat authorized_orgs.json | basenc --base64url -w0` $ echo $OR_HEADER ewogInJlc291cmNlcyI6IFsib3JnYW5pemF0aW9ucy8xMjM0NTY3ODkiXQogIm9wdGlvbnMiOiAic3RyaWN0Igp9Cgo=
- Wenn Sie testen möchten, ob die Headerkonfiguration den Zugriff auf eine Ressource in einer autorisiertenCloud de Confiance by S3NS -Organisation zulässt, erstellen Sie eine Curl-Anfrage an eine Ressource in einer autorisiertenCloud de Confiance by S3NS -Organisation.Cloud de Confiance by S3NS Hier ist ein Beispiel für eine curl-Anfrage: - # Get auth token $ TOKEN=$(gcloud auth print-access-token) # Make a request that includes the organization restriction header; this call makes a request to the logging API for a project within the same organization listed in the header $ curl -H "X-Goog-Allowed-Resources: ${OR_HEADER}" -X POST -d '{"projectIds": ["my-project-123"]}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${TOKEN}" "https://logging.googleapis.com/v2/entries:list" # A successful request returns log entries in this project
- Wenn Sie testen möchten, ob die Headerkonfiguration den Zugriff auf eine Ressource außerhalb der autorisiertenCloud de Confiance by S3NS -Organisation verweigert, erstellen Sie eine Curl-Anfrage an eine Ressource außerhalb einer autorisiertenCloud de Confiance by S3NS -Organisation. Hier ist ein Beispiel für eine curl-Anfrage: - # Get auth token $ TOKEN=$(gcloud auth print-access-token) # Make a request that includes the organization restriction header; this call makes a request to the logging API for a project not within the same organization listed in the header $ curl -H "X-Goog-Allowed-Resources: ${OR_HEADER}" -X POST -d '{"projectIds": ["other-project-123"]}' -H 'Content-Type: application/json' -H "Authorization: Bearer ${TOKEN}" "https://logging.googleapis.com/v2/entries:list" { "error": { "code": 403, "message": "Access denied by organization restriction. Contact your administrator for additional information.", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "ORG_RESTRICTION_VIOLATION", "domain": "googleapis.com", "metadata": { "service": "logging.googleapis.com", "consumer": "other-project-123" } } ] } }- Eine Fehlermeldung vom Typ „Zugriff verweigert“ gibt an, dass die Anfrage an die Ressource abgelehnt wurde. 
Nächste Schritte
- Weitere Informationen zur Verwendung von Einschränkungen für Organisationen
- Weitere Informationen zu Diensten, die von Organisationsbeschränkungen unterstützt werden