ManagementApiBuilder.domain() builds an invalid URL when the domain includes https:// or a trailing slash
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- Java
- 星號
- 319
- 分支
- 156
- 平均合併
- 20 小時 46 分鐘
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
auth0/auth0-java 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
auth0/auth0-java#887 ·
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
auth0/auth0-java#842 · 2 則留言 ·
-
feature request
難度 4/5 3-5 天 新手友好度 25/100
auth0/auth0-java#944 · 1 則留言 ·
-
bug
難度 5/5 一週以上 新手友好度 35/100
auth0/auth0-java#911 · 1 則留言 ·
-
bug
難度 3/5 1-2 天 新手友好度 25/100
auth0/auth0-java#897 ·
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
it-at-m/Wahllokalsystem#3846 ·
維護者通常 2 天內回覆
-
Area/Connector module/solace Priority/Low Type/Bug
難度 2/5 1-3 小時 新手友好度 77/100
ballerina-platform/ballerina-library#9849 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 65/100
Vakore/ZappierGames#327 ·
-
bug
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hex可能已有人在做 @matthewalberto 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 64/100
mit-cml/appinventor-sources#4246 · 1 則留言 ·
維護者通常 1 天內回覆