Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,195 changes: 969 additions & 226 deletions reference.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/main/java/com/auth0/client/mgmt/ActionsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.auth0.client.mgmt;

import com.auth0.client.mgmt.actions.ExecutionsClient;
import com.auth0.client.mgmt.actions.ModulesClient;
import com.auth0.client.mgmt.actions.TriggersClient;
import com.auth0.client.mgmt.actions.VersionsClient;
import com.auth0.client.mgmt.core.ClientOptions;
Expand Down Expand Up @@ -32,13 +33,16 @@ public class ActionsClient {

protected final Supplier<ExecutionsClient> executionsClient;

protected final Supplier<ModulesClient> modulesClient;

protected final Supplier<TriggersClient> triggersClient;

public ActionsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawActionsClient(clientOptions);
this.versionsClient = Suppliers.memoize(() -> new VersionsClient(clientOptions));
this.executionsClient = Suppliers.memoize(() -> new ExecutionsClient(clientOptions));
this.modulesClient = Suppliers.memoize(() -> new ModulesClient(clientOptions));
this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions));
}

Expand Down Expand Up @@ -177,6 +181,10 @@ public ExecutionsClient executions() {
return this.executionsClient.get();
}

public ModulesClient modules() {
return this.modulesClient.get();
}

public TriggersClient triggers() {
return this.triggersClient.get();
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/auth0/client/mgmt/AsyncActionsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.auth0.client.mgmt;

import com.auth0.client.mgmt.actions.AsyncExecutionsClient;
import com.auth0.client.mgmt.actions.AsyncModulesClient;
import com.auth0.client.mgmt.actions.AsyncTriggersClient;
import com.auth0.client.mgmt.actions.AsyncVersionsClient;
import com.auth0.client.mgmt.core.ClientOptions;
Expand Down Expand Up @@ -33,13 +34,16 @@ public class AsyncActionsClient {

protected final Supplier<AsyncExecutionsClient> executionsClient;

protected final Supplier<AsyncModulesClient> modulesClient;

protected final Supplier<AsyncTriggersClient> triggersClient;

public AsyncActionsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawActionsClient(clientOptions);
this.versionsClient = Suppliers.memoize(() -> new AsyncVersionsClient(clientOptions));
this.executionsClient = Suppliers.memoize(() -> new AsyncExecutionsClient(clientOptions));
this.modulesClient = Suppliers.memoize(() -> new AsyncModulesClient(clientOptions));
this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions));
}

Expand Down Expand Up @@ -182,6 +186,10 @@ public AsyncExecutionsClient executions() {
return this.executionsClient.get();
}

public AsyncModulesClient modules() {
return this.modulesClient.get();
}

public AsyncTriggersClient triggers() {
return this.triggersClient.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.auth0.client.mgmt.types.ClientGrantResponseContent;
import com.auth0.client.mgmt.types.CreateClientGrantRequestContent;
import com.auth0.client.mgmt.types.CreateClientGrantResponseContent;
import com.auth0.client.mgmt.types.GetClientGrantResponseContent;
import com.auth0.client.mgmt.types.ListClientGrantsRequestParameters;
import com.auth0.client.mgmt.types.UpdateClientGrantRequestContent;
import com.auth0.client.mgmt.types.UpdateClientGrantResponseContent;
Expand Down Expand Up @@ -75,6 +76,22 @@ public CompletableFuture<CreateClientGrantResponseContent> create(
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}

/**
* Retrieve a single &lt;a href=&quot;https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants&quot;&gt;client grant&lt;/a&gt;, including the
* scopes associated with the application/API pair.
*/
public CompletableFuture<GetClientGrantResponseContent> get(String id) {
return this.rawClient.get(id).thenApply(response -> response.body());
}

/**
* Retrieve a single &lt;a href=&quot;https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants&quot;&gt;client grant&lt;/a&gt;, including the
* scopes associated with the application/API pair.
*/
public CompletableFuture<GetClientGrantResponseContent> get(String id, RequestOptions requestOptions) {
return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
}

/**
* Delete the &lt;a href=&quot;https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow&quot;&gt;Client Credential Flow&lt;/a&gt; from your machine-to-machine application.
*/
Expand Down
22 changes: 13 additions & 9 deletions src/main/java/com/auth0/client/mgmt/AsyncConnectionsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public class AsyncConnectionsClient {

private final AsyncRawConnectionsClient rawClient;

protected final Supplier<AsyncClientsClient> clientsClient;

protected final Supplier<AsyncDirectoryProvisioningClient> directoryProvisioningClient;

protected final Supplier<AsyncClientsClient> clientsClient;

protected final Supplier<AsyncKeysClient> keysClient;

protected final Supplier<AsyncScimConfigurationClient> scimConfigurationClient;
Expand All @@ -41,8 +41,8 @@ public class AsyncConnectionsClient {
public AsyncConnectionsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawConnectionsClient(clientOptions);
this.clientsClient = Suppliers.memoize(() -> new AsyncClientsClient(clientOptions));
this.directoryProvisioningClient = Suppliers.memoize(() -> new AsyncDirectoryProvisioningClient(clientOptions));
this.clientsClient = Suppliers.memoize(() -> new AsyncClientsClient(clientOptions));
this.keysClient = Suppliers.memoize(() -> new AsyncKeysClient(clientOptions));
this.scimConfigurationClient = Suppliers.memoize(() -> new AsyncScimConfigurationClient(clientOptions));
this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions));
Expand Down Expand Up @@ -117,14 +117,16 @@ public CompletableFuture<SyncPagingIterable<ConnectionForList>> list(
}

/**
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.&lt;br/&gt;
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.
* <p>&lt;b&gt;Note:&lt;/b&gt; If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.</p>
*/
public CompletableFuture<CreateConnectionResponseContent> create(CreateConnectionRequestContent request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}

/**
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.&lt;br/&gt;
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.
* <p>&lt;b&gt;Note:&lt;/b&gt; If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.</p>
*/
public CompletableFuture<CreateConnectionResponseContent> create(
CreateConnectionRequestContent request, RequestOptions requestOptions) {
Expand Down Expand Up @@ -155,13 +157,15 @@ public CompletableFuture<GetConnectionResponseContent> get(

/**
* Removes a specific &lt;a href=&quot;https://auth0.com/docs/authenticate/identity-providers&quot;&gt;connection&lt;/a&gt; from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
* <p>&lt;b&gt;Note:&lt;/b&gt; If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent &lt;a href=&quot;https://auth0.com/docs/api/management/v2/connections/post-connections&quot;&gt;create connection&lt;/a&gt; requests, if they use an identical connection name.</p>
*/
public CompletableFuture<Void> delete(String id) {
return this.rawClient.delete(id).thenApply(response -> response.body());
}

/**
* Removes a specific &lt;a href=&quot;https://auth0.com/docs/authenticate/identity-providers&quot;&gt;connection&lt;/a&gt; from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
* <p>&lt;b&gt;Note:&lt;/b&gt; If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent &lt;a href=&quot;https://auth0.com/docs/api/management/v2/connections/post-connections&quot;&gt;create connection&lt;/a&gt; requests, if they use an identical connection name.</p>
*/
public CompletableFuture<Void> delete(String id, RequestOptions requestOptions) {
return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body());
Expand Down Expand Up @@ -207,14 +211,14 @@ public CompletableFuture<Void> checkStatus(String id, RequestOptions requestOpti
return this.rawClient.checkStatus(id, requestOptions).thenApply(response -> response.body());
}

public AsyncClientsClient clients() {
return this.clientsClient.get();
}

public AsyncDirectoryProvisioningClient directoryProvisioning() {
return this.directoryProvisioningClient.get();
}

public AsyncClientsClient clients() {
return this.clientsClient.get();
}

public AsyncKeysClient keys() {
return this.keysClient.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.auth0.client.mgmt.types.ClientGrantResponseContent;
import com.auth0.client.mgmt.types.CreateClientGrantRequestContent;
import com.auth0.client.mgmt.types.CreateClientGrantResponseContent;
import com.auth0.client.mgmt.types.GetClientGrantResponseContent;
import com.auth0.client.mgmt.types.ListClientGrantPaginatedResponseContent;
import com.auth0.client.mgmt.types.ListClientGrantsRequestParameters;
import com.auth0.client.mgmt.types.UpdateClientGrantRequestContent;
Expand Down Expand Up @@ -278,6 +279,91 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
return future;
}

/**
* Retrieve a single &lt;a href=&quot;https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants&quot;&gt;client grant&lt;/a&gt;, including the
* scopes associated with the application/API pair.
*/
public CompletableFuture<ManagementApiHttpResponse<GetClientGrantResponseContent>> get(String id) {
return get(id, null);
}

/**
* Retrieve a single &lt;a href=&quot;https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants&quot;&gt;client grant&lt;/a&gt;, including the
* scopes associated with the application/API pair.
*/
public CompletableFuture<ManagementApiHttpResponse<GetClientGrantResponseContent>> get(
String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("client-grants")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ManagementApiHttpResponse<GetClientGrantResponseContent>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
if (response.isSuccessful()) {
future.complete(new ManagementApiHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBodyString, GetClientGrantResponseContent.class),
response));
return;
}
try {
switch (response.code()) {
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 403:
future.completeExceptionally(new ForbiddenError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 429:
future.completeExceptionally(new TooManyRequestsError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
future.completeExceptionally(new ManagementApiException(
"Error with status code " + response.code(), response.code(), errorBody, response));
return;
} catch (IOException e) {
future.completeExceptionally(new ManagementException("Network error executing HTTP request", e));
}
}

@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ManagementException("Network error executing HTTP request", e));
}
});
return future;
}

/**
* Delete the &lt;a href=&quot;https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow&quot;&gt;Client Credential Flow&lt;/a&gt; from your machine-to-machine application.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
}

/**
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.&lt;br/&gt;
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.
* <p>&lt;b&gt;Note:&lt;/b&gt; If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.</p>
*/
public CompletableFuture<ManagementApiHttpResponse<CreateConnectionResponseContent>> create(
CreateConnectionRequestContent request) {
return create(request, null);
}

/**
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.&lt;br/&gt;
* Creates a new connection according to the JSON object received in &lt;code&gt;body&lt;/code&gt;.
* <p>&lt;b&gt;Note:&lt;/b&gt; If a connection with the same name was recently deleted and had a large number of associated users, the deletion may still be processing. Creating a new connection with that name before the deletion completes may fail or produce unexpected results.</p>
*/
public CompletableFuture<ManagementApiHttpResponse<CreateConnectionResponseContent>> create(
CreateConnectionRequestContent request, RequestOptions requestOptions) {
Expand Down Expand Up @@ -422,13 +424,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {

/**
* Removes a specific &lt;a href=&quot;https://auth0.com/docs/authenticate/identity-providers&quot;&gt;connection&lt;/a&gt; from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
* <p>&lt;b&gt;Note:&lt;/b&gt; If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent &lt;a href=&quot;https://auth0.com/docs/api/management/v2/connections/post-connections&quot;&gt;create connection&lt;/a&gt; requests, if they use an identical connection name.</p>
*/
public CompletableFuture<ManagementApiHttpResponse<Void>> delete(String id) {
return delete(id, null);
}

/**
* Removes a specific &lt;a href=&quot;https://auth0.com/docs/authenticate/identity-providers&quot;&gt;connection&lt;/a&gt; from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate.
* <p>&lt;b&gt;Note:&lt;/b&gt; If your connection has a large amount of users associated with it, please be aware that this operation can be long running after the response is returned and may impact concurrent &lt;a href=&quot;https://auth0.com/docs/api/management/v2/connections/post-connections&quot;&gt;create connection&lt;/a&gt; requests, if they use an identical connection name.</p>
*/
public CompletableFuture<ManagementApiHttpResponse<Void>> delete(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.auth0.client.mgmt.core.RequestOptions;
import com.auth0.client.mgmt.core.SyncPagingIterable;
import com.auth0.client.mgmt.errors.BadRequestError;
import com.auth0.client.mgmt.errors.ConflictError;
import com.auth0.client.mgmt.errors.ForbiddenError;
import com.auth0.client.mgmt.errors.NotFoundError;
import com.auth0.client.mgmt.errors.TooManyRequestsError;
Expand Down Expand Up @@ -234,6 +235,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 429:
future.completeExceptionally(new TooManyRequestsError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
Expand Down
Loading
Loading