Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Multi-Custom Domain (MCD) support to the Auth0 Java SDK, enabling token validation against multiple issuer domains. It also introduces OIDC Discovery, a unified caching layer, and simplifies the API surface by embedding headers into HttpRequestInfo.
Changes:
- Multi-Custom Domain support with three modes: single domain (backward-compatible), static domains list, and dynamic resolver (
DomainResolver/Auth0DomainResolver) - OIDC Discovery integration in
JWTValidatorto fetch.well-known/openid-configurationper issuer, with unifiedAuthCache(defaultInMemoryAuthCacheLRU + TTL) for both discovery metadata and JWKS providers - Simplified API:
AuthClient.verifyRequest()and authentication strategies now take onlyHttpRequestInfo(which embeds headers), removing the separateheadersparameter
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
auth0-api-java/.../AuthClient.java |
Simplified verifyRequest to accept only HttpRequestInfo |
auth0-api-java/.../AuthenticationOrchestrator.java |
Updated process signature to match new API |
auth0-api-java/.../AbstractAuthentication.java |
Removed headers param from authenticate, validateBearerToken, validateDpopTokenAndProof |
auth0-api-java/.../AllowedDPoPAuthentication.java |
Updated to use requestInfo.getHeaders() |
auth0-api-java/.../DisabledDPoPAuthentication.java |
Updated authenticate; contains commented-out code |
auth0-api-java/.../RequiredDPoPAuthentication.java |
Updated authenticate; contains commented-out code and wrong Javadoc |
auth0-api-java/.../DomainResolver.java |
New core functional interface for dynamic domain resolution |
auth0-api-java/.../models/AuthOptions.java |
Added domains, domainsResolver, cache settings; updated build validation |
auth0-api-java/.../models/HttpRequestInfo.java |
Added headers field with normalization; replaced context; new single-arg constructor |
auth0-api-java/.../models/OidcMetadata.java |
New model for OIDC discovery metadata |
auth0-api-java/.../models/RequestContext.java |
New model for domain resolver context |
auth0-api-java/.../cache/AuthCache.java |
New cache abstraction interface |
auth0-api-java/.../cache/InMemoryAuthCache.java |
New thread-safe LRU+TTL cache implementation |
auth0-api-java/.../validators/JWTValidator.java |
Major rework: OIDC discovery, MCD resolution, dynamic JwkProvider caching |
auth0-api-java/.../validators/OidcDiscoveryFetcher.java |
New OIDC discovery fetcher with caching |
auth0-api-java/.../validators/ClaimValidator.java |
Minor doc/comment cleanup |
auth0-api-java/.../examples/Auth0ApiExample.java |
Removed |
auth0-springboot-api/.../Auth0AutoConfiguration.java |
MCD wiring: resolver bean bridging, domains list, cache config |
auth0-springboot-api/.../Auth0Properties.java |
Added domains, cacheMaxEntries, cacheTtlSeconds properties |
auth0-springboot-api/.../Auth0AuthenticationFilter.java |
Updated to pass headers into HttpRequestInfo and use new verifyRequest |
auth0-springboot-api/.../Auth0DomainResolver.java |
New Spring Boot functional interface for dynamic domain resolution |
auth0-springboot-api/.../Auth0RequestContext.java |
New Spring Boot request context model |
auth0-springboot-api-playground/.../SecurityConfig.java |
Formatting changes |
auth0-springboot-api-playground/.../ProfileController.java |
Added MCD demo endpoint |
auth0-springboot-api-playground/.../McdDomainResolverExample.java |
New MCD configuration example |
| Test files (multiple) | Updated to match new API signatures, added MCD and cache tests |
Comments suppressed due to low confidence (1)
auth0-api-java/src/main/java/com/auth0/validators/JWTValidator.java:162
- The
catch (Exception e)block on line 160 unconditionally wraps all exceptions — includingVerifyAccessTokenExceptionthrown earlier in this method (e.g., "Token issuer is not in the allowed list", "Symmetric algorithms are not supported", "Discovery metadata issuer does not match token issuer") — into a new genericVerifyAccessTokenException("signature verification failed", e). This masks the specific error messages introduced for MCD validation. Consider re-throwingBaseAuthExceptioninstances directly before the generic wrap, similar to howwrapAsValidationExceptionworks elsewhere in this class.
} catch (Exception e) {
throw new VerifyAccessTokenException("signature verification failed", e);
}
auth0-api-java/src/main/java/com/auth0/RequiredDPoPAuthentication.java
Outdated
Show resolved
Hide resolved
auth0-api-java/src/main/java/com/auth0/DisabledDPoPAuthentication.java
Outdated
Show resolved
Hide resolved
auth0-api-java/src/main/java/com/auth0/RequiredDPoPAuthentication.java
Outdated
Show resolved
Hide resolved
| # Optional: Static list of allowed issuer domains (MCD) | ||
| # Mutually exclusive with domainsResolver bean | ||
| domains: | ||
| - "login.acme.com" |
There was a problem hiding this comment.
Should be custom domains of single tenant.
Better to keep the single domain with multiple sub-domains.
There was a problem hiding this comment.
Updated with -
- "brandA.acme.com"
- "brandB.acme.com"
- "brandC.acme.com"
auth0-springboot-api/EXAMPLES.md
Outdated
| auth0: | ||
| audience: "https://api.example.com" | ||
| domains: | ||
| - "login.acme.com" |
There was a problem hiding this comment.
There was a problem hiding this comment.
Updated with -
- "brandA.acme.com"
- "brandB.acme.com"
- "brandC.acme.com"
Changes
Multi-Custom Domain (MCD) support — tokens can now be validated against multiple issuer domains, enabling multi-tenant. Three configuration modes are supported:
a. Single domain (auth0.domain) — existing behavior, preserved for backward compatibility
b. Static domains list (auth0.domains) — YAML-configured list of allowed issuers
c. Dynamic resolver (Auth0DomainResolver bean) — resolve allowed issuers at request time based on headers, URL, or unverified iss claim