Skip to main content

Upstream GCP JWT Policy

Creates a JWT token (generated using a Google Service Account JSON) and attaches it to the outgoing request. Useful when calling GCP services like Cloud Endpoints / ESPv2

Configuration

tip

Be sure to read about policies

{
"name": "my-upstream-gcp-jwt-inbound-policy",
"policyType": "upstream-gcp-jwt-inbound",
"handler": {
"export": "UpstreamGcpJwtInboundPolicy",
"module": "$import(@zuplo/runtime)",
"options": {
"audience": "your_gcp_service.endpoint.com",
"serviceAccountJson": "$env(SERVICE_ACCOUNT_JSON)"
}
}
}
  • name the name of your policy instance. This is used as a reference in your routes.
  • policyType the identifier of the policy. This is used by the Zuplo UI. Value should be upstream-gcp-jwt-inbound.
  • handler/export The name of the exported type. Value should be UpstreamGcpJwtInboundPolicy.
  • handler/module the module containing the policy. Value should be $import(@zuplo/runtime).
  • handler/options The options for this policy:
    • audience
      The audience for the minted JWT. Refer to https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#google.api.AuthRequirement.
    • serviceAccountJson
      The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.