Google IAP Authentication
Google Identity-Aware Proxy provides two distinct authentication modes for different deployment scenarios.Authentication Modes
Classic IAP (iap
)
Command: oxy serve --auth-mode iap
- For: Compute Engine, GKE, App Engine with load balancers
- Authentication: Full JWT token validation with Google’s public keys
- Headers:
X-Goog-IAP-JWT-Assertion
(JWT token) - Security: High - cryptographic verification of all requests
Cloud Run IAP (iap-cloud-run
)
Command: oxy serve --auth-mode iap-cloud-run
- For: Cloud Run services with direct IAP integration
- Authentication: Trusted header-based (no JWT verification)
- Headers:
X-Goog-Authenticated-User-Email
,X-Goog-Authenticated-User-ID
- Security: Relies on Google Cloud Run’s secure infrastructure
Important: Cloud Run IAP mode trusts Google’s authentication headers directly and does not perform JWT token verification, as the Cloud Run environment guarantees these headers are authentic.
Architecture Comparison
Classic IAP Architecture
Cloud Run IAP Architecture
Deployment Guide
Choose your deployment method based on your infrastructure:Option A: Classic IAP (with Load Balancer)
1. Enable APIs
2. Create Compute Instance
3. Setup Load Balancer & Backend
4. Create OAuth & Enable IAP
Option B: Cloud Run IAP (Simplified)
1. Enable APIs
2. Create OAuth Consent Screen
3. Deploy to Cloud Run
Create aDockerfile
:
4. Enable IAP
Configure Access (Both Modes)
Authentication Headers
Classic IAP Headers
Oxy validates JWT tokens and receives:X-Goog-IAP-JWT-Assertion
: JWT token (validated cryptographically)- Additional claims extracted from JWT: email, sub, etc.
Cloud Run IAP Headers
Oxy trusts Google-provided headers without JWT verification:X-Goog-Authenticated-User-ID
: User ID (format:accounts.google.com:123456789
)X-Goog-Authenticated-User-Email
: User email (format:accounts.google.com:user@domain.com
)
Security Note: Cloud Run IAP mode relies on Google Cloud Run’s infrastructure security to ensure these headers are authentic. The application does not perform cryptographic JWT validation.
User Management
Add/Remove Users
Organize with Groups
Troubleshooting
Common Issues
Can’t Access Application
Service Not Found
Permission Denied
Cost Estimate
- Cloud Run: ~$0.18/million requests + CPU/memory usage
- IAP: Free for first 100 users, then $0.011/user/month
- Total: Typically $5-20/month for small teams
Next Steps
- Built-in Authentication - Self-hosted alternative
- AWS Cognito - AWS enterprise integration
- Authentication Overview - Compare all modes
Mode Comparison
Feature | Classic IAP | Cloud Run IAP |
---|---|---|
Command | --auth-mode iap | --auth-mode iap-cloud-run |
Infrastructure | Load Balancer + Backend | Cloud Run Direct |
Authentication | JWT Token Validation | Trusted Headers |
Security Level | High (Cryptographic) | High (Infrastructure) |
Setup Complexity | High | Low |
JWT Verification | ✅ Yes | ❌ No (trusts headers) |
Best For | Multi-service, Complex | Single service, Simple |