Skip to content

Commit 2bf5e55

Browse files
authored
Merge branch 'master' into dependabot/github_actions/gradle/wrapper-validation-action-3.5.0
2 parents 3199a1a + 683055c commit 2bf5e55

File tree

60 files changed

+2193
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2193
-91
lines changed

.version

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

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Change Log
22

3+
## [2.23.0](https://github.com/auth0/auth0-java/tree/2.23.0) (2025-07-14)
4+
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.22.0...2.23.0)
5+
6+
**Added**
7+
- Added organization support for Change Password [\#726](https://github.com/auth0/auth0-java/pull/726) ([tanya732](https://github.com/tanya732))
8+
- Fix: Resource Server Scopes [\#725](https://github.com/auth0/auth0-java/pull/725) ([tanya732](https://github.com/tanya732))
9+
10+
## [2.22.0](https://github.com/auth0/auth0-java/tree/2.22.0) (2025-06-20)
11+
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.21.0...2.22.0)
12+
13+
**Added**
14+
- Added support for connectionKeys Endpoint [\#721](https://github.com/auth0/auth0-java/pull/721) ([tanya732](https://github.com/tanya732))
15+
16+
## [2.21.0](https://github.com/auth0/auth0-java/tree/2.21.0) (2025-05-30)
17+
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.20.0...2.21.0)
18+
19+
**Added**
20+
- SDK Limit M2M Java Support [\#708](https://github.com/auth0/auth0-java/pull/708) ([tanya732](https://github.com/tanya732))
21+
- Added support for GET/PATCH Connection Endpoints [\#718](https://github.com/auth0/auth0-java/pull/718) ([tanya732](https://github.com/tanya732))
22+
- Added support for EmailTemplate [\#720](https://github.com/auth0/auth0-java/pull/720) ([tanya732](https://github.com/tanya732))
23+
24+
**Fixed**
25+
- Updated EnabledConnection [\#719](https://github.com/auth0/auth0-java/pull/719) ([tanya732](https://github.com/tanya732))
26+
27+
## [2.20.0](https://github.com/auth0/auth0-java/tree/2.20.0) (2025-05-06)
28+
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.19.0...2.20.0)
29+
30+
**Fixed**
31+
- Fixed POST/PATCH connection endpoints [\#710](https://github.com/auth0/auth0-java/pull/710) ([tanya732](https://github.com/tanya732))
32+
- Fix log event [\#711](https://github.com/auth0/auth0-java/pull/711) ([tanya732](https://github.com/tanya732))
33+
334
## [2.19.0](https://github.com/auth0/auth0-java/tree/2.19.0) (2025-03-28)
435
[Full Changelog](https://github.com/auth0/auth0-java/compare/2.18.0...2.19.0)
536

README.md

Lines changed: 2 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.19.0</version>
37+
<version>2.23.0</version>
3838
</dependency>
3939
```
4040

4141
or Gradle:
4242

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

4747
### Configure the SDK

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,31 @@ public Request<Void> resetPassword(String email, String connection) {
525525
* @return a Request to execute.
526526
*/
527527
public Request<Void> resetPassword(String clientId, String email, String connection) {
528+
return resetPassword(clientId, email, connection, null);
529+
}
530+
531+
/**
532+
* Request a password reset for the given client ID, email, database connection and organization ID. The response will always be successful even if
533+
* there's no user associated to the given email for that database connection.
534+
* i.e.:
535+
* <pre>
536+
* {@code
537+
* try {
538+
* authAPI.resetPassword("CLIENT-ID", "me@auth0.com", "db-connection", "ORGANIZATION-ID").execute().getBody();
539+
* } catch (Auth0Exception e) {
540+
* //Something happened
541+
* }
542+
* }
543+
* </pre>
544+
*
545+
* @see <a href="https://auth0.com/docs/api/authentication#change-password">Change Password API docs</a>
546+
* @param clientId the client ID of your client.
547+
* @param email the email associated to the database user.
548+
* @param connection the database connection where the user was created.
549+
* @param organization the organization ID where the user was created.
550+
* @return a Request to execute.
551+
*/
552+
public Request<Void> resetPassword(String clientId, String email, String connection, String organization) {
528553
Asserts.assertNotNull(email, "email");
529554
Asserts.assertNotNull(connection, "connection");
530555

@@ -538,6 +563,7 @@ public Request<Void> resetPassword(String clientId, String email, String connect
538563
request.addParameter(KEY_CLIENT_ID, clientId);
539564
request.addParameter(KEY_EMAIL, email);
540565
request.addParameter(KEY_CONNECTION, connection);
566+
request.addParameter(KEY_ORGANIZATION, organization);
541567
return request;
542568
}
543569

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

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package com.auth0.client.mgmt;
22

33
import com.auth0.client.mgmt.filter.ConnectionFilter;
4+
import com.auth0.client.mgmt.filter.EnabledClientsFilter;
45
import com.auth0.json.mgmt.connections.*;
56
import com.auth0.net.BaseRequest;
7+
import com.auth0.net.EmptyBodyRequest;
68
import com.auth0.net.Request;
79
import com.auth0.net.VoidRequest;
810
import com.auth0.net.client.Auth0HttpClient;
@@ -370,4 +372,95 @@ public Request<Void> checkConnectionStatus(String connectionId){
370372

371373
return new VoidRequest(client, tokenProvider, url, HttpMethod.GET);
372374
}
375+
376+
/**
377+
* Get the enabled clients for a connection.
378+
* A token with scope read:connections is needed.
379+
* @see <a href="https://auth0.com/docs/api/management/v2#!/connections/get-connection-clients">https://auth0.com/docs/api/management/v2#!/connections/get-connection-clients</a>
380+
* @param filter the filter to use. Can be null.
381+
* @return a Request to execute.
382+
*/
383+
public Request<EnabledClientResponse> getEnabledClients(String connectionId, EnabledClientsFilter filter) {
384+
Asserts.assertNotNull(connectionId, "connection id");
385+
386+
HttpUrl.Builder builder = baseUrl
387+
.newBuilder()
388+
.addPathSegments("api/v2/connections")
389+
.addPathSegment(connectionId)
390+
.addPathSegment("clients");
391+
392+
if (filter != null) {
393+
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
394+
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
395+
}
396+
}
397+
String url = builder.build().toString();
398+
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<EnabledClientResponse>() {
399+
});
400+
}
401+
402+
/**
403+
* Update the enabled clients for a connection.
404+
* A token with scope update:connections is needed.
405+
* @see <a href="https://auth0.com/docs/api/management/v2#!/connections/patch-clients">https://auth0.com/docs/api/management/v2#!/connections/patch-clients</a>
406+
*
407+
* @param connectionId the connection id.
408+
* @param enabledClientRequests the enabled client request to set.
409+
* @return a Request to execute.
410+
*/
411+
public Request<Void> updateEnabledClients(String connectionId, List<EnabledClientRequest> enabledClientRequests){
412+
Asserts.assertNotNull(connectionId, "connection id");
413+
Asserts.assertNotEmpty(enabledClientRequests, "enabled client Request");
414+
415+
String url = baseUrl
416+
.newBuilder()
417+
.addPathSegments("api/v2/connections")
418+
.addPathSegment(connectionId)
419+
.addPathSegments("clients")
420+
.build()
421+
.toString();
422+
423+
VoidRequest request = new VoidRequest(client, tokenProvider, url, HttpMethod.PATCH);
424+
request.setBody(enabledClientRequests);
425+
return request;
426+
}
427+
428+
/**
429+
* Get the Connection Keys.
430+
* A token with scope read:connections_keys is needed.
431+
* @param connectionId the connection id.
432+
* @return a Request to execute.
433+
*/
434+
public Request<List<ConnectionKeys>> getKeys(String connectionId) {
435+
Asserts.assertNotNull(connectionId, "connection id");
436+
437+
String url = baseUrl
438+
.newBuilder()
439+
.addPathSegments("api/v2/connections")
440+
.addPathSegment(connectionId)
441+
.addPathSegment("keys")
442+
.build()
443+
.toString();
444+
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<List<ConnectionKeys>>() {
445+
});
446+
}
447+
448+
/** * Rotate the Connection Keys.
449+
* A token with scope create:connections_keys and update:connections_keys is needed.
450+
* @param connectionId the connection id.
451+
* @return a Request to execute.
452+
*/
453+
public Request<RotateKey> rotateKey(String connectionId) {
454+
Asserts.assertNotNull(connectionId, "connection id");
455+
456+
String url = baseUrl
457+
.newBuilder()
458+
.addPathSegments("api/v2/connections")
459+
.addPathSegment(connectionId)
460+
.addPathSegments("keys/rotate")
461+
.build()
462+
.toString();
463+
464+
return new EmptyBodyRequest<>(client, tokenProvider, url, HttpMethod.POST, new TypeReference<RotateKey>() {});
465+
}
373466
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class EmailTemplatesEntity extends BaseManagementEntity {
2828
public static final String TEMPLATE_CHANGE_PASSWORD = "change_password";
2929
public static final String TEMPLATE_PASSWORD_RESET = "password_reset";
3030
public static final String TEMPLATE_MFA_OOB_CODE = "mfa_oob_code";
31+
public static final String TEMPLATE_VERIFY_EMAIL_BY_CODE = "verify_email_by_code";
32+
public static final String TEMPLATE_RESET_EMAIL_BY_CODE = "reset_email_by_code";
33+
public static final String TEMPLATE_USER_INVITATION = "user_invitation";
3134

3235
EmailTemplatesEntity(Auth0HttpClient client, HttpUrl baseUrl, TokenProvider tokenProvider) {
3336
super(client, baseUrl, tokenProvider);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.auth0.client.mgmt.filter;
2+
3+
public class EnabledClientsFilter extends BaseFilter {
4+
/**
5+
* Include the {@code from} parameter to specify where to start the page selection. Only applicable for endpoints that
6+
* support checkpoint pagination.
7+
*
8+
* @param from the ID from which to start selection. This can be obtained from the {@code next} field returned from
9+
* a checkpoint-paginated result.
10+
* @return this filter instance.
11+
*/
12+
public EnabledClientsFilter withFrom(String from) {
13+
parameters.put("from", from);
14+
return this;
15+
}
16+
17+
/**
18+
* Include the {@code take} parameter to specify the amount of results to return per page. Only applicable for endpoints that
19+
* support checkpoint pagination.
20+
*
21+
* @param take the amount of entries to retrieve per page.
22+
* @return this filter instance.
23+
*/
24+
public EnabledClientsFilter withTake(int take) {
25+
parameters.put("take", take);
26+
return this;
27+
}
28+
}

src/main/java/com/auth0/exception/RateLimitException.java

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.auth0.exception;
22

3+
import com.auth0.net.TokenQuotaBucket;
4+
35
import java.util.Map;
46

57
/**
@@ -16,6 +18,10 @@ public class RateLimitException extends APIException {
1618
private final long remaining;
1719
private final long reset;
1820

21+
private TokenQuotaBucket clientQuotaLimit;
22+
private TokenQuotaBucket organizationQuotaLimit;
23+
private long retryAfter;
24+
1925
private static final int STATUS_CODE_TOO_MANY_REQUEST = 429;
2026

2127
public RateLimitException(long limit, long remaining, long reset, Map<String, Object> values) {
@@ -56,4 +62,119 @@ public long getReset() {
5662
return reset;
5763
}
5864

65+
/**
66+
* Getter for the client quota limit.
67+
* @return The client quota limit or null if missing.
68+
*/
69+
public TokenQuotaBucket getClientQuotaLimit() {
70+
return clientQuotaLimit;
71+
}
72+
73+
/**
74+
* Getter for the organization quota limit.
75+
* @return The organization quota limit or null if missing.
76+
*/
77+
public TokenQuotaBucket getOrganizationQuotaLimit() {
78+
return organizationQuotaLimit;
79+
}
80+
81+
/**
82+
* Getter for the retry after time in seconds.
83+
* @return The retry after time in seconds or -1 if missing.
84+
*/
85+
public long getRetryAfter() {
86+
return retryAfter;
87+
}
88+
89+
/**
90+
* Builder class for creating instances of RateLimitException.
91+
*/
92+
public static class Builder {
93+
private long limit;
94+
private long remaining;
95+
private long reset;
96+
private TokenQuotaBucket clientQuotaLimit;
97+
private TokenQuotaBucket organizationQuotaLimit;
98+
private long retryAfter;
99+
private Map<String, Object> values;
100+
101+
/**
102+
* Constructor for the Builder.
103+
* @param limit The maximum number of requests available in the current time frame.
104+
* @param remaining The number of remaining requests in the current time frame.
105+
* @param reset The UNIX timestamp of the expected time when the rate limit will reset.
106+
*/
107+
public Builder(long limit, long remaining, long reset) {
108+
this.limit = limit;
109+
this.remaining = remaining;
110+
this.reset = reset;
111+
}
112+
113+
/**
114+
* Constructor for the Builder.
115+
* @param limit The maximum number of requests available in the current time frame.
116+
* @param remaining The number of remaining requests in the current time frame.
117+
* @param reset The UNIX timestamp of the expected time when the rate limit will reset.
118+
* @param values The values map.
119+
*/
120+
public Builder(long limit, long remaining, long reset, Map<String, Object> values) {
121+
this.limit = limit;
122+
this.remaining = remaining;
123+
this.reset = reset;
124+
this.values = values;
125+
}
126+
127+
/**
128+
* Sets the client quota limit.
129+
* @param clientQuotaLimit The client quota limit.
130+
* @return The Builder instance.
131+
*/
132+
public Builder clientQuotaLimit(TokenQuotaBucket clientQuotaLimit) {
133+
this.clientQuotaLimit = clientQuotaLimit;
134+
return this;
135+
}
136+
137+
/**
138+
* Sets the organization quota limit.
139+
* @param organizationQuotaLimit The organization quota limit.
140+
* @return The Builder instance.
141+
*/
142+
public Builder organizationQuotaLimit(TokenQuotaBucket organizationQuotaLimit) {
143+
this.organizationQuotaLimit = organizationQuotaLimit;
144+
return this;
145+
}
146+
147+
/**
148+
* Sets the retry after time in seconds.
149+
* @param retryAfter The retry after time in seconds.
150+
* @return The Builder instance.
151+
*/
152+
public Builder retryAfter(long retryAfter) {
153+
this.retryAfter = retryAfter;
154+
return this;
155+
}
156+
157+
/**
158+
* Sets the values map.
159+
* @param values The values map.
160+
* @return The Builder instance.
161+
*/
162+
public Builder values(Map<String, Object> values) {
163+
this.values = values;
164+
return this;
165+
}
166+
167+
public RateLimitException build() {
168+
RateLimitException exception = (this.values != null)
169+
? new RateLimitException(this.limit, this.remaining, this.reset, this.values)
170+
: new RateLimitException(this.limit, this.remaining, this.reset);
171+
172+
exception.clientQuotaLimit = this.clientQuotaLimit;
173+
exception.organizationQuotaLimit = this.organizationQuotaLimit;
174+
exception.retryAfter = this.retryAfter;
175+
176+
return exception;
177+
}
178+
}
179+
59180
}

0 commit comments

Comments
 (0)