diff --git a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java
index 6d4b03c21..2a8f4dff2 100644
--- a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java
+++ b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java
@@ -396,6 +396,14 @@ public SelfServiceProfilesEntity selfServiceProfiles() {
return new SelfServiceProfilesEntity(client, baseUrl, tokenProvider);
}
+ /**
+ * Getter for the Network Acls Entity
+ * @return the Network Acls Entity
+ */
+ public NetworkAclsEntity networkAcls() {
+ return new NetworkAclsEntity(client, baseUrl, tokenProvider);
+ }
+
/**
* Builder for {@link ManagementAPI} API client instances.
*/
diff --git a/src/main/java/com/auth0/client/mgmt/NetworkAclsEntity.java b/src/main/java/com/auth0/client/mgmt/NetworkAclsEntity.java
new file mode 100644
index 000000000..d0d8818c3
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/NetworkAclsEntity.java
@@ -0,0 +1,152 @@
+package com.auth0.client.mgmt;
+
+import com.auth0.client.mgmt.filter.NetworkAclsFilter;
+import com.auth0.json.mgmt.networkacls.NetworkAcls;
+import com.auth0.json.mgmt.networkacls.NetworkAclsPage;
+import com.auth0.net.BaseRequest;
+import com.auth0.net.Request;
+import com.auth0.net.VoidRequest;
+import com.auth0.net.client.Auth0HttpClient;
+import com.auth0.net.client.HttpMethod;
+import com.auth0.utils.Asserts;
+import com.fasterxml.jackson.core.type.TypeReference;
+import okhttp3.HttpUrl;
+
+import java.util.Map;
+
+public class NetworkAclsEntity extends BaseManagementEntity {
+
+ private final static String ORGS_PATH = "api/v2/network-acls";
+
+ NetworkAclsEntity(Auth0HttpClient client, HttpUrl baseUrl, TokenProvider tokenProvider) {
+ super(client, baseUrl, tokenProvider);
+ }
+
+ /**
+ * Lists all Network ACLs for the Auth0 tenant.
+ * This method allows you to filter the results using the provided {@link NetworkAclsFilter}.
+ * A token with scope read:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/get-network-acls
+ * @param filter the filter to apply to the request, can be null.
+ * @return a Request that can be executed to retrieve a page of Network ACLs.
+ */
+ public Request list(NetworkAclsFilter filter) {
+ HttpUrl.Builder builder = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH);
+
+ if (filter != null) {
+ for (Map.Entry e : filter.getAsMap().entrySet()) {
+ builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
+ }
+ }
+
+ String url = builder.build().toString();
+ return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference(){
+ });
+ }
+
+ /**
+ * Creates a new Network ACL for the Auth0 tenant.
+ * A token with scope create:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/post-network-acls
+ * @param networkAcls the Network ACL to create.
+ * @return a Request that can be executed to create the Network ACL.
+ */
+ public Request create(NetworkAcls networkAcls) {
+ Asserts.assertNotNull(networkAcls, "network acls");
+ String url = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH)
+ .build().toString();
+ BaseRequest request = new BaseRequest<>(client, tokenProvider, url, HttpMethod.POST, new TypeReference(){});
+ request.setBody(networkAcls);
+ return request;
+ }
+
+ /**
+ * Get a Network ACL by its ID.
+ * A token with scope read:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/get-network-acls-by-id
+ * @param id the ID of the Network ACL to delete.
+ * @return a Request that can be executed to delete the Network ACL.
+ */
+ public Request get(String id) {
+ Asserts.assertNotNull(id, "id");
+
+ String url = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH)
+ .addPathSegment(id)
+ .build().toString();
+
+ return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference(){});
+ }
+
+ /**
+ * Deletes a Network ACL by its ID.
+ * A token with scope delete:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/delete-network-acls-by-id
+ * @param id the ID of the Network ACL to delete.
+ * @return a Request that can be executed to delete the Network ACL.
+ */
+ public Request delete(String id) {
+ Asserts.assertNotNull(id, "id");
+
+ String url = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH)
+ .addPathSegment(id)
+ .build().toString();
+
+ return new VoidRequest(client, tokenProvider, url, HttpMethod.DELETE);
+ }
+
+ /**
+ * Updates a Network ACL by its ID.
+ * A token with scope update:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/put-network-acls-by-id
+ * @param id the ID of the Network ACL to update.
+ * @param networkAcls the Network ACL to update.
+ * @return a Request that can be executed to update the Network ACL.
+ */
+ public Request update(String id, NetworkAcls networkAcls) {
+ Asserts.assertNotNull(id, "id");
+ Asserts.assertNotNull(networkAcls, "network acls");
+
+ String url = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH)
+ .addPathSegment(id)
+ .build().toString();
+
+ BaseRequest request = new BaseRequest<>(client, tokenProvider, url, HttpMethod.PUT, new TypeReference() {
+ });
+ request.setBody(networkAcls);
+ return request;
+ }
+
+ /**
+ * Partially updates a Network ACL by its ID.
+ * A token with scope update:network_acls is needed.
+ *
+ * @see https://auth0.com/docs/api/management/v2#!/network-acls/patch-network-acls-by-id
+ * @param id the ID of the Network ACL to update.
+ * @param networkAcls the Network ACL to update.
+ * @return a Request that can be executed to partially update the Network ACL.
+ */
+ public Request patch(String id, NetworkAcls networkAcls) {
+ Asserts.assertNotNull(id, "id");
+
+ String url = baseUrl.newBuilder()
+ .addPathSegments(ORGS_PATH)
+ .addPathSegment(id)
+ .build().toString();
+
+ BaseRequest request = new BaseRequest<>(client, tokenProvider, url, HttpMethod.PATCH, new TypeReference() {
+ });
+ request.setBody(networkAcls);
+ return request;
+ }
+
+}
diff --git a/src/main/java/com/auth0/client/mgmt/filter/NetworkAclsFilter.java b/src/main/java/com/auth0/client/mgmt/filter/NetworkAclsFilter.java
new file mode 100644
index 000000000..c17624ddf
--- /dev/null
+++ b/src/main/java/com/auth0/client/mgmt/filter/NetworkAclsFilter.java
@@ -0,0 +1,28 @@
+package com.auth0.client.mgmt.filter;
+
+public class NetworkAclsFilter extends BaseFilter {
+
+ /**
+ * Filter by page
+ *
+ * @param pageNumber the page number to retrieve.
+ * @param amountPerPage the amount of items per page to retrieve.
+ * @return this filter instance
+ */
+ public NetworkAclsFilter withPage(int pageNumber, int amountPerPage) {
+ parameters.put("page", pageNumber);
+ parameters.put("per_page", amountPerPage);
+ return this;
+ }
+
+ /**
+ * Include the query summary
+ *
+ * @param includeTotals whether to include or not the query summary.
+ * @return this filter instance
+ */
+ public NetworkAclsFilter withTotals(boolean includeTotals) {
+ parameters.put("include_totals", includeTotals);
+ return this;
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/Action.java b/src/main/java/com/auth0/json/mgmt/networkacls/Action.java
new file mode 100644
index 000000000..029d86118
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/Action.java
@@ -0,0 +1,108 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Action {
+ @JsonProperty("block")
+ private Boolean block;
+ @JsonProperty("allow")
+ private Boolean allow;
+ @JsonProperty("log")
+ private Boolean log;
+ @JsonProperty("redirect")
+ private Boolean redirect;
+ @JsonProperty("redirect_uri")
+ private String redirectUri;
+
+ /**
+ * Getter for the block action.
+ * @return true if the action is to block.
+ */
+ @JsonProperty("block")
+ public Boolean isBlock() {
+ return block;
+ }
+
+ /**
+ * Setter for the block action.
+ * @param block true to set the action as block, false otherwise.
+ */
+ @JsonProperty("block")
+ public void setBlock(Boolean block) {
+ this.block = block;
+ }
+
+ /**
+ * Getter for the allow action.
+ * @return true if the action is to allow.
+ */
+ @JsonProperty("allow")
+ public Boolean isAllow() {
+ return allow;
+ }
+
+ /**
+ * Setter for the allow action.
+ * @param allow true to set the action as allow, false otherwise.
+ */
+ @JsonProperty("allow")
+ public void setAllow(Boolean allow) {
+ this.allow = allow;
+ }
+
+ /**
+ * Getter for the log action.
+ * @return true if the action is to log.
+ */
+ @JsonProperty("log")
+ public Boolean isLog() {
+ return log;
+ }
+
+ /**
+ * Setter for the log action.
+ * @param log true to set the action as log, false otherwise.
+ */
+ @JsonProperty("log")
+ public void setLog(Boolean log) {
+ this.log = log;
+ }
+
+ /**
+ * Getter for the redirect action.
+ * @return true if the action is to redirect.
+ */
+ @JsonProperty("redirect")
+ public Boolean isRedirect() {
+ return redirect;
+ }
+
+ /**
+ * Setter for the redirect action.
+ * @param redirect true to set the action as redirect, false otherwise.
+ */
+ @JsonProperty("redirect")
+ public void setRedirect(Boolean redirect) {
+ this.redirect = redirect;
+ }
+
+ /**
+ * Getter for the redirect URI.
+ * @return the redirect URI if set, null otherwise.
+ */
+ public String getRedrectUri() {
+ return redirectUri;
+ }
+
+ /**
+ * Setter for the redirect URI.
+ * @param redrectUri the URI to set for redirection.
+ */
+ public void setRedrectUri(String redrectUri) {
+ this.redirectUri = redrectUri;
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/Match.java b/src/main/java/com/auth0/json/mgmt/networkacls/Match.java
new file mode 100644
index 000000000..dd8759eae
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/Match.java
@@ -0,0 +1,155 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Match {
+ private List asns;
+ @JsonProperty("geo_country_codes")
+ private List geoCountryCodes;
+ @JsonProperty("geo_subdivision_codes")
+ private List geoSubdivisionCodes;
+ @JsonProperty("ipv4_cidrs")
+ private List ipv4Cidrs;
+ @JsonProperty("ipv6_cidrs")
+ private List ipv6Cidrs;
+ @JsonProperty("ja3_fingerprints")
+ private List ja3Fingerprints;
+ @JsonProperty("ja4_fingerprints")
+ private List ja4Fingerprints;
+ @JsonProperty("user_agents")
+ private List userAgents;
+
+ /**
+ * Getter for the ASNs.
+ * @return a list of ASNs.
+ */
+ public List getAsns() {
+ return asns;
+ }
+
+ /**
+ * Setter for the ASNs.
+ * @param asns a list of ASNs to set.
+ */
+ public void setAsns(List asns) {
+ this.asns = asns;
+ }
+
+ /**
+ * Getter for the geo country codes.
+ * @return a list of geo country codes.
+ */
+ public List getGeoCountryCodes() {
+ return geoCountryCodes;
+ }
+
+ /**
+ * Setter for the geo country codes.
+ * @param geoCountryCodes a list of geo country codes to set.
+ */
+ public void setGeoCountryCodes(List geoCountryCodes) {
+ this.geoCountryCodes = geoCountryCodes;
+ }
+
+ /**
+ * Getter for the geo subdivision codes.
+ * @return a list of geo subdivision codes.
+ */
+ public List getGeoSubdivisionCodes() {
+ return geoSubdivisionCodes;
+ }
+
+ /**
+ * Setter for the geo subdivision codes.
+ * @param geoSubdivisionCodes a list of geo subdivision codes to set.
+ */
+ public void setGeoSubdivisionCodes(List geoSubdivisionCodes) {
+ this.geoSubdivisionCodes = geoSubdivisionCodes;
+ }
+
+ /**
+ * Getter for the IPv4 CIDRs.
+ * @return a list of IPv4 CIDRs.
+ */
+ public List getIpv4Cidrs() {
+ return ipv4Cidrs;
+ }
+
+ /**
+ * Setter for the IPv4 CIDRs.
+ * @param ipv4Cidrs a list of IPv4 CIDRs to set.
+ */
+ public void setIpv4Cidrs(List ipv4Cidrs) {
+ this.ipv4Cidrs = ipv4Cidrs;
+ }
+
+ /**
+ * Getter for the IPv6 CIDRs.
+ * @return a list of IPv6 CIDRs.
+ */
+ public List getIpv6Cidrs() {
+ return ipv6Cidrs;
+ }
+
+ /**
+ * Setter for the IPv6 CIDRs.
+ * @param ipv6Cidrs a list of IPv6 CIDRs to set.
+ */
+ public void setIpv6Cidrs(List ipv6Cidrs) {
+ this.ipv6Cidrs = ipv6Cidrs;
+ }
+
+ /**
+ * Getter for the JA3 fingerprints.
+ * @return a list of JA3 fingerprints.
+ */
+ public List getJa3Fingerprints() {
+ return ja3Fingerprints;
+ }
+
+ /**
+ * Setter for the JA3 fingerprints.
+ * @param ja3Fingerprints a list of JA3 fingerprints to set.
+ */
+ public void setJa3Fingerprints(List ja3Fingerprints) {
+ this.ja3Fingerprints = ja3Fingerprints;
+ }
+
+ /**
+ * Getter for the JA4 fingerprints.
+ * @return a list of JA4 fingerprints.
+ */
+ public List getJa4Fingerprints() {
+ return ja4Fingerprints;
+ }
+
+ /**
+ * Setter for the JA4 fingerprints.
+ * @param ja4Fingerprints a list of JA4 fingerprints to set.
+ */
+ public void setJa4Fingerprints(List ja4Fingerprints) {
+ this.ja4Fingerprints = ja4Fingerprints;
+ }
+
+ /**
+ * Getter for the user agents.
+ * @return a list of user agents.
+ */
+ public List getUserAgents() {
+ return userAgents;
+ }
+
+ /**
+ * Setter for the user agents.
+ * @param userAgents a list of user agents to set.
+ */
+ public void setUserAgents(List userAgents) {
+ this.userAgents = userAgents;
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAcls.java b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAcls.java
new file mode 100644
index 000000000..3385fa343
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAcls.java
@@ -0,0 +1,114 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NetworkAcls {
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("active")
+ private boolean active;
+ @JsonProperty("priority")
+ private int priority;
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("rule")
+ private Rule rule;
+ @JsonProperty("created_at")
+ private String createdAt;
+ @JsonProperty("updated_at")
+ private String updatedAt;
+
+ /**
+ * Getter for the ID of the network ACL.
+ * @return the ID of the network ACL.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Getter for the creation timestamp of the network ACL.
+ * @return the creation timestamp of the network ACL.
+ */
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ /**
+ * Getter for the last updated timestamp of the network ACL.
+ * @return the last updated timestamp of the network ACL.
+ */
+ public String getUpdatedAt() {
+ return updatedAt;
+ }
+
+ /**
+ * Getter for the description of the network ACL.
+ * @return the description of the network ACL.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Setter for the description of the network ACL.
+ * @param description the description to set for the network ACL.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Checks if the network ACL is active.
+ * @return true if the network ACL is active, false otherwise.
+ */
+ @JsonProperty("active")
+ public boolean isActive() {
+ return active;
+ }
+
+ /**
+ * Setter for the active status of the network ACL.
+ * @param active true to set the network ACL as active, false to set it as inactive.
+ */
+ @JsonProperty("active")
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ /**
+ * Getter for the priority of the network ACL.
+ * @return the priority of the network ACL.
+ */
+ public int getPriority() {
+ return priority;
+ }
+
+ /**
+ * Setter for the priority of the network ACL.
+ * @param priority the priority to set for the network ACL.
+ */
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ /**
+ * Getter for the rule associated with the network ACL.
+ * @return the rule of the network ACL.
+ */
+ public Rule getRule() {
+ return rule;
+ }
+
+ /**
+ * Setter for the rule associated with the network ACL.
+ * @param rule the rule to set for the network ACL.
+ */
+ public void setRule(Rule rule) {
+ this.rule = rule;
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPage.java b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPage.java
new file mode 100644
index 000000000..192b8ab40
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPage.java
@@ -0,0 +1,22 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.auth0.json.mgmt.Page;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonDeserialize(using = NetworkAclsPageDeserializer.class)
+public class NetworkAclsPage extends Page {
+
+ public NetworkAclsPage(List items) {
+ super(items);
+ }
+
+ public NetworkAclsPage(Integer start, Integer length, Integer total, Integer limit, List items) {
+ super(start, length, total, limit, items);
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageDeserializer.java b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageDeserializer.java
new file mode 100644
index 000000000..100fd5bde
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageDeserializer.java
@@ -0,0 +1,21 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.auth0.json.mgmt.PageDeserializer;
+
+import java.util.List;
+
+public class NetworkAclsPageDeserializer extends PageDeserializer {
+ protected NetworkAclsPageDeserializer() {
+ super(NetworkAcls.class, "network_acls");
+ }
+
+ @Override
+ protected NetworkAclsPage createPage(List items) {
+ return new NetworkAclsPage(items);
+ }
+
+ @Override
+ protected NetworkAclsPage createPage(Integer start, Integer length, Integer total, Integer limit, List items) {
+ return new NetworkAclsPage(start, length, total, limit, items);
+ }
+}
diff --git a/src/main/java/com/auth0/json/mgmt/networkacls/Rule.java b/src/main/java/com/auth0/json/mgmt/networkacls/Rule.java
new file mode 100644
index 000000000..dad6bca7f
--- /dev/null
+++ b/src/main/java/com/auth0/json/mgmt/networkacls/Rule.java
@@ -0,0 +1,84 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Rule {
+ @JsonProperty("action")
+ private Action action;
+ @JsonProperty("match")
+ private Match match;
+ @JsonProperty("not_match")
+ private Match notMatch;
+ @JsonProperty("scope")
+ private String scope;
+
+ /**
+ * Getter for the action associated with the rule.
+ * @return the action.
+ */
+ public Action getAction() {
+ return action;
+ }
+
+ /**
+ * Setter for the action associated with the rule.
+ * @param action the action to set.
+ */
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ /**
+ * Getter for the match criteria of the rule.
+ * @return the match criteria.
+ */
+ public Match getMatch() {
+ return match;
+ }
+
+ /**
+ * Setter for the match criteria of the rule.
+ * @param match the match criteria to set.
+ */
+ public void setMatch(Match match) {
+ this.match = match;
+ }
+
+ /**
+ * Getter for the not match criteria of the rule.
+ * @return the not match criteria.
+ */
+ public Match getNotMatch() {
+ return notMatch;
+ }
+
+ /**
+ * Setter for the not match criteria of the rule.
+ * @param notMatch the not match criteria to set.
+ */
+ public void setNotMatch(Match notMatch) {
+ this.notMatch = notMatch;
+ }
+
+ /**
+ * Getter for the scope of the rule.
+ * @return the scope of the rule.
+ */
+ public String getScope() {
+ return scope;
+ }
+
+ /**
+ * Setter for the scope of the rule.
+ * @param scope the scope to set for the rule.
+ */
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+}
diff --git a/src/test/java/com/auth0/client/MockServer.java b/src/test/java/com/auth0/client/MockServer.java
index 4e059da14..7b86e527b 100644
--- a/src/test/java/com/auth0/client/MockServer.java
+++ b/src/test/java/com/auth0/client/MockServer.java
@@ -120,6 +120,8 @@ public class MockServer {
public static final String MGMT_JOB_POST_USERS_IMPORTS = "src/test/resources/mgmt/job_post_users_imports.json";
public static final String MGMT_JOB_POST_USERS_IMPORTS_INPUT = "src/test/resources/mgmt/job_post_users_imports_input.json";
public static final String MGMT_JOB_ERROR_DETAILS = "src/test/resources/mgmt/job_error_details.json";
+ public static final String MGMT_NETWORK_ACLS_LIST = "src/test/resources/mgmt/network_acls_list.json";
+ public static final String MGMT_NETWORK_ACLS = "src/test/resources/mgmt/network_acls.json";
public static final String MULTIPART_SAMPLE = "src/test/resources/mgmt/multipart_sample.json";
public static final String PASSWORDLESS_EMAIL_RESPONSE = "src/test/resources/auth/passwordless_email.json";
public static final String PASSWORDLESS_SMS_RESPONSE = "src/test/resources/auth/passwordless_sms.json";
diff --git a/src/test/java/com/auth0/client/mgmt/NetworkAclsEntityTest.java b/src/test/java/com/auth0/client/mgmt/NetworkAclsEntityTest.java
new file mode 100644
index 000000000..49e31f78c
--- /dev/null
+++ b/src/test/java/com/auth0/client/mgmt/NetworkAclsEntityTest.java
@@ -0,0 +1,235 @@
+package com.auth0.client.mgmt;
+
+import com.auth0.client.MockServer;
+import com.auth0.client.mgmt.filter.NetworkAclsFilter;
+import com.auth0.json.mgmt.networkacls.*;
+import com.auth0.net.Request;
+import com.auth0.net.client.HttpMethod;
+import okhttp3.mockwebserver.RecordedRequest;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static com.auth0.AssertsUtil.verifyThrows;
+import static com.auth0.client.MockServer.*;
+import static com.auth0.client.RecordedRequestMatcher.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+
+public class NetworkAclsEntityTest extends BaseMgmtEntityTest {
+
+ // Network ACLs entity
+
+ @Test
+ public void shouldListNetworkAclsWithoutFilter() throws Exception {
+ Request request = api.networkAcls().list(null);
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS_LIST, 200);
+ NetworkAclsPage response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/network-acls"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+
+ assertThat(response, is(notNullValue()));
+ assertThat(response.getItems(), hasSize(2));
+ }
+
+ @Test
+ public void shouldListNetworkAclsWithFilter() throws Exception {
+ NetworkAclsFilter filter = new NetworkAclsFilter()
+ .withPage(0, 10)
+ .withTotals(true);
+
+ Request request = api.networkAcls().list(filter);
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS_LIST, 200);
+ NetworkAclsPage response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/network-acls"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+ assertThat(recordedRequest, hasQueryParameter("page", "0"));
+ assertThat(recordedRequest, hasQueryParameter("per_page", "10"));
+ assertThat(recordedRequest, hasQueryParameter("include_totals", "true"));
+
+ assertThat(response, is(notNullValue()));
+ assertThat(response.getItems(), hasSize(2));
+ }
+
+ @Test
+ public void shouldThrowOnCreateNetworkAclWithNullNetworkAcls() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().create(null),
+ "'network acls' cannot be null!");
+ }
+
+ @Test
+ public void shouldCreateNetworkAcl() throws Exception {
+ NetworkAcls networkAclsToCreate = new NetworkAcls();
+ networkAclsToCreate.setDescription("Log America and Canada all the time.");
+ networkAclsToCreate.setActive(true);
+ networkAclsToCreate.setPriority(1);
+ Rule rule = new Rule();
+ Action action = new Action();
+ action.setLog(true);
+ rule.setAction(action);
+
+ rule.setScope("authentication");
+
+ Match match = new Match();
+ List geoCountryCodes = new ArrayList<>();
+ geoCountryCodes.add("US");
+ geoCountryCodes.add("CA");
+
+ match.setGeoCountryCodes(geoCountryCodes);
+ rule.setMatch(match);
+ networkAclsToCreate.setRule(rule);
+
+
+ Request request = api.networkAcls().create(networkAclsToCreate);
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS, 201);
+ NetworkAcls response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.POST, "/api/v2/network-acls"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+
+ Map body = bodyFromRequest(recordedRequest);
+ assertThat(body, aMapWithSize(4));
+ assertThat(body, hasEntry("description", "Log America and Canada all the time."));
+ assertThat(body, hasEntry("active", true));
+ assertThat(body, hasEntry("priority", 1));
+ assertThat(body, hasEntry(is("rule"), is(notNullValue())));
+
+ assertThat(response, is(notNullValue()));
+ }
+
+ @Test
+ public void shouldThrowOnGetNetworkAclWithNullId() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().get(null),
+ "'id' cannot be null!");
+ }
+
+ @Test
+ public void shouldGetNetworkAcl() throws Exception {
+ Request request = api.networkAcls().get("acl_1");
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS, 200);
+ NetworkAcls response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/network-acls/acl_1"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+
+ assertThat(response, is(notNullValue()));
+ assertThat(response.getId(), is("acl_1"));
+ assertThat(response.getDescription(), is("Log America and Canada all the time."));
+ }
+
+ @Test
+ public void shouldThrowOnDeleteNetworkAclWithNullId() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().delete(null),
+ "'id' cannot be null!");
+ }
+
+ @Test
+ public void shouldDeleteNetworkAcl() throws Exception {
+ Request request = api.networkAcls().delete("acl_1");
+ assertThat(request, is(notNullValue()));
+
+ server.emptyResponse(204);
+ request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.DELETE, "/api/v2/network-acls/acl_1"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+ }
+
+ @Test
+ public void shouldThrowOnUpdateNetworkAclWithNullId() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().update(null, new NetworkAcls()),
+ "'id' cannot be null!");
+ }
+
+ @Test
+ public void shouldThrowOnUpdateNetworkAclWithNullNetworkAcls() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().update("acl_1", null),
+ "'network acls' cannot be null!");
+ }
+
+ @Test
+ public void shouldUpdateNetworkAcl() throws Exception {
+ NetworkAcls networkAclsToUpdate = new NetworkAcls();
+ networkAclsToUpdate.setDescription("Log America and Canada all the time.");
+ networkAclsToUpdate.setActive(false);
+ networkAclsToUpdate.setPriority(5);
+
+ Request request = api.networkAcls().update("acl_1", networkAclsToUpdate);
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS, 200);
+ NetworkAcls response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.PUT, "/api/v2/network-acls/acl_1"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+
+ Map body = bodyFromRequest(recordedRequest);
+ assertThat(body, aMapWithSize(3));
+ assertThat(body, hasEntry("description", "Log America and Canada all the time."));
+ assertThat(body, hasEntry("active", false));
+ assertThat(body, hasEntry("priority", 5));
+
+ assertThat(response, is(notNullValue()));
+ }
+
+ @Test
+ public void shouldThrowOnPatchNetworkAclWithNullId() {
+ verifyThrows(IllegalArgumentException.class,
+ () -> api.networkAcls().patch(null, new NetworkAcls()),
+ "'id' cannot be null!");
+ }
+
+ @Test
+ public void shouldPatchNetworkAcl() throws Exception {
+ NetworkAcls networkAclsToPatch = new NetworkAcls();
+ networkAclsToPatch.setActive(true);
+ networkAclsToPatch.setPriority(3);
+
+ Request request = api.networkAcls().patch("acl_1", networkAclsToPatch);
+ assertThat(request, is(notNullValue()));
+
+ server.jsonResponse(MockServer.MGMT_NETWORK_ACLS, 200);
+ NetworkAcls response = request.execute().getBody();
+ RecordedRequest recordedRequest = server.takeRequest();
+
+ assertThat(recordedRequest, hasMethodAndPath(HttpMethod.PATCH, "/api/v2/network-acls/acl_1"));
+ assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
+ assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
+
+ Map body = bodyFromRequest(recordedRequest);
+ assertThat(body, aMapWithSize(2));
+ assertThat(body, hasEntry("active", true));
+ assertThat(body, hasEntry("priority", 3));
+
+ assertThat(response, is(notNullValue()));
+ }
+}
diff --git a/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageTest.java b/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageTest.java
new file mode 100644
index 000000000..ed39d9156
--- /dev/null
+++ b/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsPageTest.java
@@ -0,0 +1,115 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.auth0.json.JsonTest;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+public class NetworkAclsPageTest extends JsonTest {
+
+ private static final String jsonWithTotal = "{\n" +
+ " \"total\": 2,\n" +
+ " \"start\": 0,\n" +
+ " \"limit\": 2,\n" +
+ " \"network_acls\": [\n" +
+ " {\n" +
+ " \"description\": \"Log America and Canada all the time.\",\n" +
+ " \"active\": true,\n" +
+ " \"priority\": 1,\n" +
+ " \"rule\": {\n" +
+ " \"match\": {\n" +
+ " \"geo_country_codes\": [\n" +
+ " \"US\",\n" +
+ " \"CA\"\n" +
+ " ]\n" +
+ " },\n" +
+ " \"scope\": \"authentication\",\n" +
+ " \"action\": {\n" +
+ " \"log\": true\n" +
+ " }\n" +
+ " },\n" +
+ " \"created_at\": \"2025-03-17T12:31:57.782Z\",\n" +
+ " \"updated_at\": \"2025-03-17T12:31:57.782Z\",\n" +
+ " \"id\": \"acl_1\"\n" +
+ " },\n" +
+ " {\n" +
+ " \"description\": \"Test Desc - 1\",\n" +
+ " \"active\": true,\n" +
+ " \"priority\": 10,\n" +
+ " \"rule\": {\n" +
+ " \"match\": {\n" +
+ " \"ipv4_cidrs\": [\n" +
+ " \"198.0.0.0\",\n" +
+ " \"10.0.0.0/24\"\n" +
+ " ]\n" +
+ " },\n" +
+ " \"scope\": \"management\",\n" +
+ " \"action\": {\n" +
+ " \"block\": true\n" +
+ " }\n" +
+ " },\n" +
+ " \"created_at\": \"2025-06-10T06:18:10.277Z\",\n" +
+ " \"updated_at\": \"2025-06-10T06:18:10.277Z\",\n" +
+ " \"id\": \"acl_2\"\n" +
+ " }\n" +
+ " ]\n" +
+ "}";
+
+ private static final String jsonWithoutTotal = "[\n" +
+ " {\n" +
+ " \"description\": \"Test Desc - 1\",\n" +
+ " \"active\": true,\n" +
+ " \"priority\": 10,\n" +
+ " \"rule\": {\n" +
+ " \"match\": {\n" +
+ " \"ipv4_cidrs\": [\n" +
+ " \"198.0.0.0\",\n" +
+ " \"10.0.0.0/24\"\n" +
+ " ]\n" +
+ " },\n" +
+ " \"scope\": \"management\",\n" +
+ " \"action\": {\n" +
+ " \"block\": true\n" +
+ " }\n" +
+ " },\n" +
+ " \"created_at\": \"2025-06-10T06:18:10.277Z\",\n" +
+ " \"updated_at\": \"2025-06-10T06:18:10.277Z\",\n" +
+ " \"id\": \"acl_1\"\n" +
+ " }\n" +
+ "]";
+
+ @Test
+ public void shouldDeserializeWithTotal() throws Exception {
+ NetworkAclsPage page = fromJSON(jsonWithTotal, NetworkAclsPage.class);
+
+ assertThat(page, is(notNullValue()));
+ assertThat(page.getStart(), is(0));
+ assertThat(page.getTotal(), is(2));
+ assertThat(page.getLimit(), is(2));
+ assertThat(page.getItems(), is(notNullValue()));
+ assertThat(page.getItems().size(), is(2));
+ assertThat(page.getItems().get(0).getDescription(), is("Log America and Canada all the time."));
+ assertThat(page.getItems().get(0).isActive(), is(true));
+ assertThat(page.getItems().get(0).getPriority(), is(1));
+ assertThat(page.getItems().get(0).getId(), is("acl_1"));
+ assertThat(page.getItems().get(0).getCreatedAt(), is("2025-03-17T12:31:57.782Z"));
+ assertThat(page.getItems().get(0).getUpdatedAt(), is("2025-03-17T12:31:57.782Z"));
+ }
+
+ @Test
+ public void shouldDeserializeWithoutTotal() throws Exception {
+ NetworkAclsPage page = fromJSON(jsonWithoutTotal, NetworkAclsPage.class);
+
+ assertThat(page, is(notNullValue()));
+ assertThat(page.getItems(), is(notNullValue()));
+ assertThat(page.getItems().size(), is(1));
+ assertThat(page.getItems().get(0).getDescription(), is("Test Desc - 1"));
+ assertThat(page.getItems().get(0).isActive(), is(true));
+ assertThat(page.getItems().get(0).getPriority(), is(10));
+ assertThat(page.getItems().get(0).getId(), is("acl_1"));
+ assertThat(page.getItems().get(0).getCreatedAt(), is("2025-06-10T06:18:10.277Z"));
+ assertThat(page.getItems().get(0).getUpdatedAt(), is("2025-06-10T06:18:10.277Z"));
+ }
+}
diff --git a/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsTest.java b/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsTest.java
new file mode 100644
index 000000000..5b7abb9dd
--- /dev/null
+++ b/src/test/java/com/auth0/json/mgmt/networkacls/NetworkAclsTest.java
@@ -0,0 +1,54 @@
+package com.auth0.json.mgmt.networkacls;
+
+import com.auth0.json.JsonTest;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+
+import static com.auth0.json.JsonMatcher.hasEntry;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+public class NetworkAclsTest extends JsonTest {
+
+ private final static String NETWORK_ACLS_JSON = "src/test/resources/mgmt/network_acls.json";
+
+ @Test
+ public void deserialize() throws Exception {
+ NetworkAcls deserialized = fromJSON(readTextFile(NETWORK_ACLS_JSON), NetworkAcls.class);
+
+ assertThat(deserialized.getDescription(), is("Log America and Canada all the time."));
+ assertThat(deserialized.isActive(), is(true));
+ assertThat(deserialized.getPriority(), is(1));
+ assertThat(deserialized.getId(), is("acl_1"));
+ assertThat(deserialized.getCreatedAt(), is("2025-03-17T12:31:57.782Z"));
+ assertThat(deserialized.getUpdatedAt(), is("2025-03-17T12:31:57.782Z"));
+ }
+
+ @Test
+ public void serialize() throws Exception {
+ NetworkAcls networkAcls = new NetworkAcls();
+ networkAcls.setDescription("Log America and Canada all the time.");
+ networkAcls.setActive(true);
+ networkAcls.setPriority(1);
+
+ Rule rule = new Rule();
+ Match match = new Match();
+ match.setGeoCountryCodes(Arrays.asList("US", "CA"));
+ rule.setMatch(match);
+ rule.setScope("authentication");
+ Action action = new Action();
+ action.setLog(true);
+ rule.setAction(action);
+
+ networkAcls.setRule(rule);
+
+ String json = toJSON(networkAcls);
+
+ assertThat(json, hasEntry("description", "Log America and Canada all the time."));
+ assertThat(json, hasEntry("active", true));
+ assertThat(json, hasEntry("priority", 1));
+ assertThat(json, hasEntry("rule", notNullValue()));
+ }
+}
diff --git a/src/test/resources/mgmt/network_acls.json b/src/test/resources/mgmt/network_acls.json
new file mode 100644
index 000000000..d618014d9
--- /dev/null
+++ b/src/test/resources/mgmt/network_acls.json
@@ -0,0 +1,20 @@
+{
+ "description": "Log America and Canada all the time.",
+ "active": true,
+ "priority": 1,
+ "rule": {
+ "match": {
+ "geo_country_codes": [
+ "US",
+ "CA"
+ ]
+ },
+ "scope": "authentication",
+ "action": {
+ "log": true
+ }
+ },
+ "created_at": "2025-03-17T12:31:57.782Z",
+ "updated_at": "2025-03-17T12:31:57.782Z",
+ "id": "acl_1"
+}
diff --git a/src/test/resources/mgmt/network_acls_list.json b/src/test/resources/mgmt/network_acls_list.json
new file mode 100644
index 000000000..d9496a31a
--- /dev/null
+++ b/src/test/resources/mgmt/network_acls_list.json
@@ -0,0 +1,47 @@
+{
+ "total": 14,
+ "start": 0,
+ "length": 14,
+ "network_acls": [
+ {
+ "description": "Log America and Canada all the time.",
+ "active": true,
+ "priority": 1,
+ "rule": {
+ "match": {
+ "geo_country_codes": [
+ "US",
+ "CA"
+ ]
+ },
+ "scope": "authentication",
+ "action": {
+ "log": true
+ }
+ },
+ "created_at": "2025-03-17T12:31:57.782Z",
+ "updated_at": "2025-03-17T12:31:57.782Z",
+ "id": "acl_1"
+ },
+ {
+ "description": "Test Desc - 1",
+ "active": true,
+ "priority": 10,
+ "rule": {
+ "match": {
+ "ipv4_cidrs": [
+ "198.51.100.48",
+ "10.0.0.0/24"
+ ]
+ },
+ "scope": "management",
+ "action": {
+ "block": true
+ }
+ },
+ "created_at": "2025-06-10T06:18:10.277Z",
+ "updated_at": "2025-06-10T06:18:10.277Z",
+ "id": "acl_2"
+ }
+ ]
+}