-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: Adds support for Multiple Custom Domains #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b101a38
Feat: Updated Methods Signature
tanya732 264a291
Feat: Added MCD Support
tanya732 66250f0
Merge branch 'main' into feat/mcd-initials
tanya732 a3949c1
Feat: Added Transitive dependency
tanya732 53a9f2a
Updated Readme
tanya732 c2955a7
Merge main branch
tanya732 84c2121
Update with Main Branch
tanya732 3443a60
Updated the branch
tanya732 792d5e8
Updated comments and removed commented code
tanya732 0ce8219
Merge branch 'feat/mcd-initials' into feat/mcd-feature
tanya732 0652a23
Merge pull request #14 from auth0/feat/mcd-feature
tanya732 0c4c34e
Remove Empty files
tanya732 a10b4eb
Updated Example and Readme
tanya732 b37cdeb
Updated Example and Readme
tanya732 f27d4ae
Updated Example and Readme
tanya732 49a5d7d
Resolving changes from main branch
tanya732 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
auth0-api-java/src/main/java/com/auth0/DomainResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package com.auth0; | ||
|
|
||
| import com.auth0.models.RequestContext; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Functional interface for dynamically resolving allowed issuer domains | ||
| * based on the incoming request context. | ||
| * <p> | ||
| * Used in multi-custom-domain (MCD) scenarios where the set of valid issuers | ||
| * cannot be determined statically at configuration time. The resolver receives | ||
| * a {@link RequestContext} containing the request URL, headers, and the | ||
| * unverified token issuer, and returns the list of allowed issuer domains. | ||
| * </p> | ||
| * | ||
| * <pre>{@code | ||
| * AuthOptions options = new AuthOptions.Builder() | ||
| * .domainsResolver(context -> { | ||
| * String host = context.getHeaders().get("host"); | ||
| * return lookupIssuersForHost(host); | ||
| * }) | ||
| * .audience("https://api.example.com") | ||
| * .build(); | ||
| * }</pre> | ||
| * | ||
| * @see RequestContext | ||
| * @see com.auth0.models.AuthOptions.Builder#domainsResolver(DomainResolver) | ||
| */ | ||
| @FunctionalInterface | ||
| public interface DomainResolver { | ||
|
|
||
| /** | ||
| * Resolves the list of allowed issuer domains for the given request context. | ||
| * | ||
| * @param context the request context containing URL, headers, and unverified | ||
| * token issuer | ||
| * @return a list of allowed issuer domain strings (e.g., | ||
| * {@code ["https://tenant1.auth0.com/"]}); | ||
| * may return {@code null} or an empty list if no domains can be | ||
| * resolved | ||
| */ | ||
| List<String> resolveDomains(RequestContext context); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
auth0-api-java/src/main/java/com/auth0/cache/AuthCache.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package com.auth0.cache; | ||
|
|
||
| /** | ||
| * Cache abstraction for storing authentication-related data such as | ||
| * OIDC discovery metadata and JWKS providers. | ||
| * <p> | ||
| * The SDK ships with a default in-memory LRU implementation | ||
| * ({@link InMemoryAuthCache}). Users can implement this interface | ||
| * to plug in distributed cache backends (e.g., Redis, Memcached) without | ||
| * breaking changes to the SDK's public API. | ||
| * </p> | ||
| * | ||
| * <p> | ||
| * A single {@code AuthCache<Object>} instance can serve as a unified cache | ||
| * for both discovery metadata and JWKS providers by using key prefixes: | ||
| * </p> | ||
| * <ul> | ||
| * <li>{@code discovery:{issuerUrl}} — OIDC discovery metadata</li> | ||
| * <li>{@code jwks:{jwksUri}} — JwkProvider instances</li> | ||
| * </ul> | ||
| * | ||
| * <h3>Thread Safety</h3> | ||
| * <p> | ||
| * All implementations <b>must</b> be thread-safe. | ||
| * </p> | ||
| * | ||
| * @param <V> the type of cached values | ||
| */ | ||
| public interface AuthCache<V> { | ||
|
|
||
| /** | ||
| * Retrieves a value from the cache. | ||
| * | ||
| * @param key the cache key | ||
| * @return the cached value, or {@code null} if not present or expired | ||
| */ | ||
| V get(String key); | ||
|
|
||
| /** | ||
| * Stores a value in the cache with the cache's default TTL. | ||
| * | ||
| * @param key the cache key | ||
| * @param value the value to cache | ||
| */ | ||
| void put(String key, V value); | ||
|
|
||
| /** | ||
| * Removes a specific entry from the cache. | ||
| * | ||
| * @param key the cache key to remove | ||
| */ | ||
| void remove(String key); | ||
|
|
||
| /** | ||
| * Removes all entries from the cache. | ||
| */ | ||
| void clear(); | ||
|
|
||
| /** | ||
| * Returns the number of entries currently in the cache. | ||
| * | ||
| * @return the cache size | ||
| */ | ||
| int size(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.