Commit a10c4c6
authored
feat:Add
Added support for the `Auth0-Custom-Domain` header to enable Multiple
Custom Domains (MCD).
### Changes
- Added `custom_domain` parameter to `ManagementClient` and
`AsyncManagementClient` for setting the `Auth0-Custom-Domain` header
globally
- Added `CustomDomainHeader` helper for per-request header override via
`request_options`
- Implemented whitelist enforcement via httpx event hooks , header is
only sent on 8 whitelisted endpoints, stripped on all others
| Path | Description |
|------|-------------|
| `/api/v2/jobs/verification-email` | Verification email jobs |
| `/api/v2/tickets/email-verification` | Email verification tickets |
| `/api/v2/tickets/password-change` | Password change tickets |
| `/api/v2/organizations/{id}/invitations` | Organization invitations |
| `/api/v2/users` | Users (list/create) |
| `/api/v2/users/{id}` | Users (get/update/delete) |
| `/api/v2/guardian/enrollments/ticket` | Guardian enrollment tickets |
| `/api/v2/self-service-profiles/{id}/sso-ticket` | SSO tickets |
Enforcement is implemented via httpx request event hooks that strip the
header on non-whitelisted paths before the request is sent.
- Per-request `CustomDomainHeader` takes precedence over the global
`custom_domain` when both are provided
- Added 22 unit tests covering initialization, header merging, whitelist
enforcement, and async support
- Updated `README.md` with Custom Domains documentation
### Usage
```python
from auth0.management import ManagementClient, CustomDomainHeader
# Global — header sent on all whitelisted endpoints
client = ManagementClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
custom_domain="login.mycompany.com",
)
# Per-request override
client.users.create(
connection="Username-Password-Authentication",
email="user@example.com",
password="SecurePass123!",
request_options=CustomDomainHeader("other.mycompany.com"),
)
```
### References
- Closes [#794](#794)
### Checklist
- [x] All new/changed/fixed functionality is covered by tests
- [x] I have added documentation for all new/changed functionality
- [x] No Fern-generated files modified (all changes in
`.fernignore`-listed files)Auth0-Custom-Domain header support for Multiple Custom Domains (MCD) (#799)1 parent 05ae030 commit a10c4c6
File tree
6 files changed
+434
-194
lines changed- src/auth0/management
- tests/management
6 files changed
+434
-194
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
318 | 356 | | |
319 | 357 | | |
320 | 358 | | |
| |||
0 commit comments