You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: auth0-springboot-api/EXAMPLES.md
+10-17Lines changed: 10 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,7 +282,16 @@ public class AdminController {
282
282
283
283
## Multiple Custom Domains (MCD)
284
284
285
-
For APIs that accept tokens from multiple Auth0 custom domains (e.g., multi-tenant SaaS, domain migrations).
285
+
Multiple Custom Domains (MCD) support enables a single API application to accept access tokens issued by multiple domains associated with the same **Auth0 tenant**, including the canonical domain and its custom domains.
286
+
287
+
This is commonly required in scenarios such as:
288
+
289
+
1. Multi-brand applications (B2C) where each brand uses a different custom domain but they all share the same API.
290
+
2. A single API serves multiple frontend applications that use different custom domains.
291
+
3. A gradual migration from the canonical domain to a custom domain, where both domains need to be supported during the transition period.
292
+
293
+
In these cases, your API must trust and validate tokens from multiple issuers instead of a single domain.
294
+
The SDK supports two approaches for configuring multiple domains, Static Domain List and Dynamic Domain Resolver.
286
295
287
296
### 1. Static Domain List
288
297
@@ -326,22 +335,6 @@ public class McdConfig {
326
335
327
336
When a `DomainResolver` bean is present, it takes priority over the static `domains` list. The resolver receives a `RequestContext` with the request URL, headers, and the unverified `iss` claim from the token.
328
337
329
-
### 3. Domain + Domains Coexistence (Auth for Agents)
330
-
331
-
For Auth for Agents scenarios, `domain` and `domains` can coexist. The `domain` is used for Auth for Agents flows (token exchange, authorization), while `domains` is used for token validation:
332
-
333
-
```yaml
334
-
auth0:
335
-
domain: "primary-tenant.auth0.com" # For Auth for Agents flows
336
-
audience: "https://api.example.com"
337
-
domains: # For token validation
338
-
- "primary-tenant.auth0.com"
339
-
- "tenant2.auth0.com"
340
-
- "tenant3.auth0.com"
341
-
```
342
-
343
-
When both are present, the SDK always uses `domains` for token verification.
344
-
345
338
## Caching
346
339
347
340
The SDK caches OIDC discovery metadata and JWKS providers in a unified cache. By default, it uses a thread-safe in-memory LRU cache.
0 commit comments