Authentication & Access Control¶
The Modigie Integration for Cloud Pub/Sub API supports both managed service account authentication and keyless integration using customer-owned Google Cloud service accounts.
Authenticate with Pub/Sub¶
Depending on your repository configuration, your application authenticates with Cloud Pub/Sub using one of two approaches:
1. Keyless Publishing with Customer Service Accounts (Recommended for GCP Workloads)¶
If your application workloads run on Google Cloud (e.g., Google Kubernetes Engine with Workload Identity, Cloud Run, or Compute Engine) or use Google Cloud Workload Identity Federation, you can publish job requests directly using your own service accounts.
- Configuration: Provide your service account email address(es) in
requestPublishersunderownerConfigfor each job type. - Automatic IAM: Modigie tenant-infra automatically grants the Pub/Sub Publisher role (
roles/pubsub.publisher) on the Modigie request topic to your service account. - Keyless ADC: Your application does not need private key JSON files. It authenticates natively using Google Cloud Application Default Credentials (ADC).
Exclusivity Boundary
When you configure requestPublishers for a job type, publishing job requests becomes the exclusive responsibility of your designated service account(s). The Modigie-provisioned Application Account is restricted from publishing job requests and is used strictly for delivering job responses.
For more details, see Customer-Owned Google Cloud Resources.
2. Modigie Application Account (Default)¶
If you do not configure customer service accounts, your application authenticates using the dedicated Application Account created for your repository. See Custom Google Service Account.
The simplest way is to download and store the JSON key file of your Application Account in your application's secure secret manager:
- https://cloud.google.com/pubsub/docs/authentication
- https://cloud.google.com/docs/authentication/application-default-credentials
Depending on your hosting provider, you may also use Workload Identity Federation to authenticate as the Application Account without permanent keys:
- AWS
- Microsoft Entra ID
- GitHub
- GitLab
- Kubernetes clusters
- Okta
- On-premises Active Directory Federation Services (AD FS)
- Terraform
Learn more:
- https://cloud.google.com/iam/docs/workload-identity-federation
- https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds
Authorizing Job Responses on Customer-Owned Topics¶
When you configure a customer-owned Cloud Pub/Sub topic to receive job responses (responseTopic), Modigie backend services publish response messages directly across GCP projects to your topic.
To permit message publishing, you must grant the Pub/Sub Publisher role (roles/pubsub.publisher) on your topic to Modigie's tenant Application Account:
inpubsub-app-<REPO_SHORT_HASH>@<TENANT_PROJECT_ID>.iam.gserviceaccount.com
Granting Permission via gcloud CLI¶
gcloud pubsub topics add-iam-policy-binding <TOPIC_ID> \
--project=<CUSTOMER_PROJECT_ID> \
--role="roles/pubsub.publisher" \
--member="serviceAccount:inpubsub-app-<REPO_SHORT_HASH>@<TENANT_PROJECT_ID>.iam.gserviceaccount.com"
For complete setup instructions, see Customer-Owned Google Cloud Resources.
Verify pushed messages¶
If your application uses a Modigie-managed push subscription for the delivery of messages, it should verify the authenticity of the incoming HTTPS requests.
All messages that the repository pushes to your webhook endpoint are signed with a JSON Web Token (JWT) issued by the repository's Application Account.
Your application is responsible for verifying that the JWT in the Authorization header is valid and signed by this service account.
Learn how to verify a JSON Web Token (JWT): https://cloud.google.com/pubsub/docs/authenticate-push-subscriptions