ManagementApiBuilder.domain() builds an invalid URL when the domain includes https:// or a trailing slash
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
Piste de recherche
Start with ManagementApiBuilder.domain(...) and compare its URL construction with AuthAPI.newBuilder(...). Verify how domains containing https:// or a trailing slash are normalized, then add regression coverage for both forms. Done means the Management API, token, and default audience URLs use the expected https:// host and /api/v2 path without duplicated schemes or slashes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
ManagementApi.builder().domain(...) always prepends https:// and appends /api/v2 to the value as given. If the domain already includes the scheme, or ends with a slash, the client is built with an invalid API URL, and the client credentials flow requests a token from an invalid URL with an invalid default audience.
AuthAPI.newBuilder(domain, ...) accepts both my-tenant.auth0.com and https://my-tenant.auth0.com, and so did ManagementAPI.newBuilder(domain, ...) in 2.x. Code that passes the same domain value to both clients, or that was migrated from 2.x, fails at request time.
Reproduction
ManagementApi mgmt = ManagementApi.builder()
.domain("https://my-tenant.auth0.com")
.clientCredentials("{CLIENT_ID}", "{CLIENT_SECRET}")
.build();
mgmt.users().list();
domain(...) value |
Management API URL | Token URL | Default audience |
|---|---|---|---|
https://my-tenant.auth0.com |
https://https://my-tenant.auth0.com/api/v2 |
https://https://my-tenant.auth0.com/oauth/token |
https://https://my-tenant.auth0.com/api/v2/ |
my-tenant.auth0.com/ |
https://my-tenant.auth0.com//api/v2 |
https://my-tenant.auth0.com/oauth/token |
https://my-tenant.auth0.com//api/v2/ |
In the first case, no request reaches the tenant. The second case requests a token for an audience that does not match the Management API identifier, and API calls go to a //api/v2 path.
Expected behavior
domain() accepts the domain with or without https:// and with or without a trailing slash, as AuthAPI does, and builds https://my-tenant.auth0.com/api/v2.
Environment
- auth0-java 5.4.0 (
mainat 484f9bb) - Java 8
- Langage dominant
- Java
- Étoiles
- 319
- Forks
- 156
- Merge moyen
- 20 h 46 min
- PR mergées (30 j)
- 3
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de auth0/auth0-java
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
auth0/auth0-java#887 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
auth0/auth0-java#842 · 2 commentaires ·
-
feature request
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
auth0/auth0-java#944 · 1 commentaire ·
-
bug
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
auth0/auth0-java#911 · 1 commentaire ·
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 25/100
auth0/auth0-java#897 ·
Toutes les issues de auth0/auth0-java
Issues similaires
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
it-at-m/Wahllokalsystem#3846 ·
Les mainteneurs répondent en général sous 2 jours
-
Area/Connector module/solace Priority/Low Type/Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
ballerina-platform/ballerina-library#9849 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
Vakore/ZappierGames#327 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hexPeut-être pris @matthewalberto l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
mit-cml/appinventor-sources#4246 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour