Skip to content

Commit 926a2d6

Browse files
authored
Merge branch 'master' into Remove-Semgrep-GHA-non-EMU
2 parents f430b9a + f5408e7 commit 926a2d6

File tree

24 files changed

+1551
-37
lines changed

24 files changed

+1551
-37
lines changed

.github/actions/maven-publish/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ runs:
3636

3737
- name: Publish Android/Java Packages to Maven
3838
shell: bash
39-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --stacktrace
39+
run: ./gradlew publishToSonatype closeSonatypeStagingRepository -PisSnapshot=false --stacktrace
4040
env:
4141
JAVA_HOME: ${{ env.JAVA_HOME }}
4242
MAVEN_USERNAME: ${{ inputs.ossr-username }}

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.23.0
1+
2.24.0

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Change Log
22

3-
## [2.23.0](https://github.com/auth0/auth0-java/tree/2.23.0) (2025-07-21)
3+
## [2.24.0](https://github.com/auth0/auth0-java/tree/2.24.0) (2025-08-22)
4+
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.23.0...2.24.0)
5+
6+
**Added**
7+
- Update Readme and Examples [\#752](https://github.com/auth0/auth0-java/pull/752) ([tanya732](https://github.com/tanya732))
8+
- Customize management api token provider [\#748](https://github.com/auth0/auth0-java/pull/748) ([tanya732](https://github.com/tanya732))
9+
- Joaosoumoreira/add method to enroll email mfa [\#744](https://github.com/auth0/auth0-java/pull/744) ([tanya732](https://github.com/tanya732))
10+
11+
## [2.23.0](https://github.com/auth0/auth0-java/tree/2.23.0) (2025-08-05)
412
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.22.0...2.23.0)
513

614
**Added**
15+
- Added support for Tenant ACL [\#723](https://github.com/auth0/auth0-java/pull/723) ([tanya732](https://github.com/tanya732))
716
- Added organization support for Change Password [\#726](https://github.com/auth0/auth0-java/pull/726) ([tanya732](https://github.com/tanya732))
8-
9-
**Fixed**
1017
- Fix: Resource Server Scopes [\#725](https://github.com/auth0/auth0-java/pull/725) ([tanya732](https://github.com/tanya732))
1118

1219
## [2.22.0](https://github.com/auth0/auth0-java/tree/2.22.0) (2025-06-20)

EXAMPLES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,22 @@ AuthAPI auth = AuthAPI.newBuilder("DOMAIN", "CLIENT-ID", "CLIENT-SECRET")
3838
.withHttpClient(client)
3939
.build();
4040

41+
```
42+
43+
```java
44+
4145
ManagementAPI mgmt = ManagementAPI.newBuilder("DOMAIN", "API-TOKEN")
4246
.withHttpClient(client)
4347
.build();
48+
49+
// OR
50+
51+
TokenProvider tokenProvider = SimpleTokenProvider.create("API-TOKEN");
52+
53+
ManagementAPI mgmt = ManagementAPI.newBuilder("DOMAIN", tokenProvider)
54+
.withHttpClient(client)
55+
.build();
56+
4457
```
4558

4659
If the `DefaultHttpClient` does not support your required networking client configuration, you may choose to implement

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Add the dependency via Maven:
3434
<dependency>
3535
<groupId>com.auth0</groupId>
3636
<artifactId>auth0</artifactId>
37-
<version>2.23.0</version>
37+
<version>2.24.0</version>
3838
</dependency>
3939
```
4040

4141
or Gradle:
4242

4343
```gradle
44-
implementation 'com.auth0:auth0:2.23.0'
44+
implementation 'com.auth0:auth0:2.24.0'
4545
```
4646

4747
### Configure the SDK
@@ -66,6 +66,15 @@ Create a `ManagementAPI` instance by providing the domain from the [Application
6666
ManagementAPI mgmt = ManagementAPI.newBuilder("{YOUR_DOMAIN}", "{YOUR_API_TOKEN}").build();
6767
```
6868

69+
OR
70+
71+
Create a `ManagementAPI` instance by providing the domain from the [Application dashboard](https://manage.auth0.com/#/applications) and Token Provider.
72+
73+
```java
74+
TokenProvider tokenProvider = SimpleTokenProvider.create("{YOUR_API_TOKEN}");
75+
ManagementAPI mgmt = ManagementAPI.newBuilder("{YOUR_DOMAIN}", TokenProvider).build();
76+
```
77+
6978
The Management API is organized by entities represented by the Auth0 Management API objects.
7079

7180
```java

gradle/maven-publish.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ artifacts {
2828
publishing {
2929
publications {
3030
mavenJava(MavenPublication) {
31+
from components.java
32+
33+
artifact sourcesJar
34+
artifact javadocJar
3135

3236
groupId = GROUP
3337
artifactId = POM_ARTIFACT_ID
3438
version = getVersionName()
3539

36-
artifact("$buildDir/libs/${project.name}-${version}.jar")
37-
artifact sourcesJar
38-
artifact javadocJar
39-
4040
pom {
4141
name = POM_NAME
4242
packaging = POM_PACKAGING

src/main/java/com/auth0/client/auth/AuthAPI.java

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public Request<BackChannelAuthorizeResponse> authorizeBackChannel(String scope,
251251
request.addParameter(KEY_AUDIENCE, audience);
252252
}
253253
if(Objects.nonNull(requestExpiry)){
254-
request.addParameter("request_expiry", requestExpiry);
254+
request.addParameter("requested_expiry", requestExpiry);
255255
}
256256

257257
try {
@@ -1395,6 +1395,27 @@ public Request<CreatedOtpResponse> addOtpAuthenticator(String mfaToken) {
13951395
return request;
13961396
}
13971397

1398+
1399+
private BaseRequest<CreatedOobResponse> createBaseOobRequest(String mfaToken, List<String> oobChannels) {
1400+
String url = baseUrl
1401+
.newBuilder()
1402+
.addPathSegment("mfa")
1403+
.addPathSegment("associate")
1404+
.build()
1405+
.toString();
1406+
1407+
BaseRequest<CreatedOobResponse> request = new BaseRequest<>(client, null, url, HttpMethod.POST, new TypeReference<CreatedOobResponse>() {
1408+
});
1409+
1410+
request.addParameter("authenticator_types", Collections.singletonList("oob"));
1411+
request.addParameter("oob_channels", oobChannels);
1412+
request.addParameter(KEY_CLIENT_ID, clientId);
1413+
addClientAuthentication(request, false);
1414+
request.addHeader("Authorization", "Bearer " + mfaToken);
1415+
1416+
return request;
1417+
}
1418+
13981419
/**
13991420
* Associates or adds a new OOB authenticator for multi-factor authentication (MFA).
14001421
* Confidential clients (Regular Web Apps) <strong>must</strong> have a client secret configured on this {@code AuthAPI} instance.
@@ -1415,32 +1436,67 @@ public Request<CreatedOtpResponse> addOtpAuthenticator(String mfaToken) {
14151436
* @param phoneNumber The phone number for "sms" or "voice" channels. May be null if not using "sms" or "voice".
14161437
* @return a Request to execute.
14171438
* @see <a href="https://auth0.com/docs/api/authentication#add-an-authenticator">Add an Authenticator API documentation</a>
1439+
* @deprecated Use {@linkplain #addOobAuthenticator(String, List, String, String)} instead.
14181440
*/
1441+
@Deprecated
14191442
public Request<CreatedOobResponse> addOobAuthenticator(String mfaToken, List<String> oobChannels, String phoneNumber) {
14201443
Asserts.assertNotNull(mfaToken, "mfa token");
14211444
Asserts.assertNotNull(oobChannels, "OOB channels");
1445+
if (oobChannels.contains("sms") || oobChannels.contains("voice")) {
1446+
Asserts.assertNotNull(phoneNumber, "phone number");
1447+
}
14221448

1423-
String url = baseUrl
1424-
.newBuilder()
1425-
.addPathSegment("mfa")
1426-
.addPathSegment("associate")
1427-
.build()
1428-
.toString();
1429-
1430-
BaseRequest<CreatedOobResponse> request = new BaseRequest<>(client, null, url, HttpMethod.POST, new TypeReference<CreatedOobResponse>() {
1431-
});
1449+
BaseRequest<CreatedOobResponse> request = createBaseOobRequest(mfaToken, oobChannels);
14321450

1433-
request.addParameter("authenticator_types", Collections.singletonList("oob"));
1434-
request.addParameter("oob_channels", oobChannels);
1435-
request.addParameter(KEY_CLIENT_ID, clientId);
14361451
if (phoneNumber != null) {
14371452
request.addParameter("phone_number", phoneNumber);
14381453
}
1439-
addClientAuthentication(request, false);
1440-
request.addHeader("Authorization", "Bearer " + mfaToken);
1454+
14411455
return request;
14421456
}
14431457

1458+
/**
1459+
* Associates or adds a new OOB authenticator for multi-factor authentication (MFA).
1460+
* Confidential clients (Regular Web Apps) <strong>must</strong> have a client secret configured on this {@code AuthAPI} instance.
1461+
* <pre>
1462+
* {@code
1463+
* try {
1464+
* CreatedOobResponse result = authAPI.addOobAuthenticator("the-mfa-token", Arrays.asList("sms", "email"), "phone-number", "email-address")
1465+
* .execute()
1466+
* .getBody();
1467+
* } catch (Auth0Exception e) {
1468+
* //Something happened
1469+
* }
1470+
* }
1471+
* </pre>
1472+
*
1473+
* @param mfaToken The token received from mfa_required error. Must not be null.
1474+
* @param oobChannels The type of OOB channels supported by the client. Must not be null.
1475+
* @param phoneNumber The phone number for "sms" or "voice" channels. May be null if not using "sms" or "voice".
1476+
* @param emailAddress The email address for "email" channel. May be null if not using "email".
1477+
* @return a Request to execute.
1478+
* @see <a href="https://auth0.com/docs/secure/multi-factor-authentication/authenticate-using-ropg-flow-with-mfa/enroll-challenge-sms-voice-authenticators#enroll-with-sms-or-voice">Enroll with SMS or voice</a>
1479+
*/
1480+
public Request<CreatedOobResponse> addOobAuthenticator(String mfaToken, List<String> oobChannels, String phoneNumber, String emailAddress) {
1481+
Asserts.assertNotNull(mfaToken, "mfa token");
1482+
Asserts.assertNotNull(oobChannels, "OOB channels");
1483+
if (oobChannels.contains("sms") || oobChannels.contains("voice")) {
1484+
Asserts.assertNotNull(phoneNumber, "phone number");
1485+
}
1486+
if (oobChannels.contains("email")) {
1487+
Asserts.assertNotNull(emailAddress, "email address");
1488+
}
1489+
1490+
BaseRequest<CreatedOobResponse> request = createBaseOobRequest(mfaToken, oobChannels);
1491+
if (phoneNumber != null) {
1492+
request.addParameter("phone_number", phoneNumber);
1493+
}
1494+
if (emailAddress != null) {
1495+
request.addParameter("email", emailAddress);
1496+
}
1497+
1498+
return request;
1499+
}
14441500

14451501
/**
14461502
* Returns a list of authenticators associated with your application.

src/main/java/com/auth0/client/mgmt/ManagementAPI.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ public static ManagementAPI.Builder newBuilder(String domain, String apiToken) {
6767
return new ManagementAPI.Builder(domain, apiToken);
6868
}
6969

70+
/**
71+
* Instantiate a new {@link Builder} to configure and build a new ManagementAPI client.
72+
*
73+
* @param domain the tenant's domain. Must be a non-null valid HTTPS domain.
74+
* @param tokenProvider the API Token provider to use when making requests.
75+
* @return a Builder for further configuration.
76+
*/
77+
public static ManagementAPI.Builder newBuilder(String domain, TokenProvider tokenProvider) {
78+
return new ManagementAPI.Builder(domain, tokenProvider);
79+
}
80+
7081
private ManagementAPI(String domain, TokenProvider tokenProvider, Auth0HttpClient httpClient) {
7182
Asserts.assertNotNull(domain, "domain");
7283
Asserts.assertNotNull(tokenProvider, "token provider");
@@ -396,12 +407,20 @@ public SelfServiceProfilesEntity selfServiceProfiles() {
396407
return new SelfServiceProfilesEntity(client, baseUrl, tokenProvider);
397408
}
398409

410+
/**
411+
* Getter for the Network Acls Entity
412+
* @return the Network Acls Entity
413+
*/
414+
public NetworkAclsEntity networkAcls() {
415+
return new NetworkAclsEntity(client, baseUrl, tokenProvider);
416+
}
417+
399418
/**
400419
* Builder for {@link ManagementAPI} API client instances.
401420
*/
402421
public static class Builder {
403422
private final String domain;
404-
private final String apiToken;
423+
private final TokenProvider tokenProvider;
405424
private Auth0HttpClient httpClient = DefaultHttpClient.newBuilder().build();
406425

407426
/**
@@ -410,8 +429,17 @@ public static class Builder {
410429
* @param apiToken the API token used to make requests to the Auth0 Management API.
411430
*/
412431
public Builder(String domain, String apiToken) {
432+
this(domain, SimpleTokenProvider.create(apiToken));
433+
}
434+
435+
/**
436+
* Create a new Builder
437+
* @param domain the domain of the tenant.
438+
* @param tokenProvider the API Token provider to use when making requests.
439+
*/
440+
public Builder(String domain, TokenProvider tokenProvider) {
413441
this.domain = domain;
414-
this.apiToken = apiToken;
442+
this.tokenProvider = tokenProvider;
415443
}
416444

417445
/**
@@ -430,7 +458,7 @@ public Builder withHttpClient(Auth0HttpClient httpClient) {
430458
* @return the configured {@code ManagementAPI} instance.
431459
*/
432460
public ManagementAPI build() {
433-
return new ManagementAPI(domain, SimpleTokenProvider.create(apiToken), httpClient);
461+
return new ManagementAPI(domain, tokenProvider, httpClient);
434462
}
435463
}
436464
}

0 commit comments

Comments
 (0)