Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
325 changes: 231 additions & 94 deletions reference.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ public class AsyncConnectionsClient {

protected final Supplier<AsyncDirectoryProvisioningClient> directoryProvisioningClient;

protected final Supplier<AsyncScimConfigurationClient> scimConfigurationClient;

protected final Supplier<AsyncClientsClient> clientsClient;

protected final Supplier<AsyncKeysClient> keysClient;

protected final Supplier<AsyncScimConfigurationClient> scimConfigurationClient;

protected final Supplier<AsyncUsersClient> usersClient;

public AsyncConnectionsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawConnectionsClient(clientOptions);
this.directoryProvisioningClient = Suppliers.memoize(() -> new AsyncDirectoryProvisioningClient(clientOptions));
this.scimConfigurationClient = Suppliers.memoize(() -> new AsyncScimConfigurationClient(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 @@ -250,6 +250,10 @@ public AsyncDirectoryProvisioningClient directoryProvisioning() {
return this.directoryProvisioningClient.get();
}

public AsyncScimConfigurationClient scimConfiguration() {
return this.scimConfigurationClient.get();
}

public AsyncClientsClient clients() {
return this.clientsClient.get();
}
Expand All @@ -258,10 +262,6 @@ public AsyncKeysClient keys() {
return this.keysClient.get();
}

public AsyncScimConfigurationClient scimConfiguration() {
return this.scimConfigurationClient.get();
}

public AsyncUsersClient users() {
return this.usersClient.get();
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/auth0/client/mgmt/ConnectionsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ public class ConnectionsClient {

protected final Supplier<DirectoryProvisioningClient> directoryProvisioningClient;

protected final Supplier<ScimConfigurationClient> scimConfigurationClient;

protected final Supplier<ClientsClient> clientsClient;

protected final Supplier<KeysClient> keysClient;

protected final Supplier<ScimConfigurationClient> scimConfigurationClient;

protected final Supplier<UsersClient> usersClient;

public ConnectionsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawConnectionsClient(clientOptions);
this.directoryProvisioningClient = Suppliers.memoize(() -> new DirectoryProvisioningClient(clientOptions));
this.scimConfigurationClient = Suppliers.memoize(() -> new ScimConfigurationClient(clientOptions));
this.clientsClient = Suppliers.memoize(() -> new ClientsClient(clientOptions));
this.keysClient = Suppliers.memoize(() -> new KeysClient(clientOptions));
this.scimConfigurationClient = Suppliers.memoize(() -> new ScimConfigurationClient(clientOptions));
this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions));
}

Expand Down Expand Up @@ -248,6 +248,10 @@ public DirectoryProvisioningClient directoryProvisioning() {
return this.directoryProvisioningClient.get();
}

public ScimConfigurationClient scimConfiguration() {
return this.scimConfigurationClient.get();
}

public ClientsClient clients() {
return this.clientsClient.get();
}
Expand All @@ -256,10 +260,6 @@ public KeysClient keys() {
return this.keysClient.get();
}

public ScimConfigurationClient scimConfiguration() {
return this.scimConfigurationClient.get();
}

public UsersClient users() {
return this.usersClient.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public String getTo() {
return to;
}

/**
* @return Medium to use to send the notification
*/
@JsonProperty("delivery_method")
public Optional<PhoneProviderDeliveryMethodEnum> getDeliveryMethod() {
return deliveryMethod;
Expand Down Expand Up @@ -96,6 +99,9 @@ public interface _FinalStage {

_FinalStage additionalProperties(Map<String, Object> additionalProperties);

/**
* <p>Medium to use to send the notification</p>
*/
_FinalStage deliveryMethod(Optional<PhoneProviderDeliveryMethodEnum> deliveryMethod);

_FinalStage deliveryMethod(PhoneProviderDeliveryMethodEnum deliveryMethod);
Expand Down Expand Up @@ -131,12 +137,19 @@ public _FinalStage to(@NotNull String to) {
return this;
}

/**
* <p>Medium to use to send the notification</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage deliveryMethod(PhoneProviderDeliveryMethodEnum deliveryMethod) {
this.deliveryMethod = Optional.ofNullable(deliveryMethod);
return this;
}

/**
* <p>Medium to use to send the notification</p>
*/
@java.lang.Override
@JsonSetter(value = "delivery_method", nulls = Nulls.SKIP)
public _FinalStage deliveryMethod(Optional<PhoneProviderDeliveryMethodEnum> deliveryMethod) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.auth0.client.mgmt.core.OptionalNullable;
import com.auth0.client.mgmt.core.RequestOptions;
import com.auth0.client.mgmt.types.ConnectionKey;
import com.auth0.client.mgmt.types.PostConnectionKeysRequestContent;
import com.auth0.client.mgmt.types.PostConnectionsKeysResponseContentItem;
import com.auth0.client.mgmt.types.RotateConnectionKeysRequestContent;
import com.auth0.client.mgmt.types.RotateConnectionsKeysResponseContent;
import java.util.List;
Expand Down Expand Up @@ -43,6 +45,37 @@ public CompletableFuture<List<ConnectionKey>> get(String id, RequestOptions requ
return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<List<PostConnectionsKeysResponseContentItem>> create(String id) {
return this.rawClient.create(id).thenApply(response -> response.body());
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<List<PostConnectionsKeysResponseContentItem>> create(
String id, RequestOptions requestOptions) {
return this.rawClient.create(id, requestOptions).thenApply(response -> response.body());
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<List<PostConnectionsKeysResponseContentItem>> create(
String id, OptionalNullable<PostConnectionKeysRequestContent> request) {
return this.rawClient.create(id, request).thenApply(response -> response.body());
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<List<PostConnectionsKeysResponseContentItem>> create(
String id, OptionalNullable<PostConnectionKeysRequestContent> request, RequestOptions requestOptions) {
return this.rawClient.create(id, request, requestOptions).thenApply(response -> response.body());
}

/**
* Rotates the connection keys for the Okta or OIDC connection strategies.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
import com.auth0.client.mgmt.core.OptionalNullable;
import com.auth0.client.mgmt.core.RequestOptions;
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;
import com.auth0.client.mgmt.errors.UnauthorizedError;
import com.auth0.client.mgmt.types.ConnectionKey;
import com.auth0.client.mgmt.types.PostConnectionKeysRequestContent;
import com.auth0.client.mgmt.types.PostConnectionsKeysResponseContentItem;
import com.auth0.client.mgmt.types.RotateConnectionKeysRequestContent;
import com.auth0.client.mgmt.types.RotateConnectionsKeysResponseContent;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -135,6 +138,134 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
return future;
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<ManagementApiHttpResponse<List<PostConnectionsKeysResponseContentItem>>> create(
String id) {
return create(id, OptionalNullable.<PostConnectionKeysRequestContent>absent());
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<ManagementApiHttpResponse<List<PostConnectionsKeysResponseContentItem>>> create(
String id, RequestOptions requestOptions) {
return create(id, OptionalNullable.<PostConnectionKeysRequestContent>absent(), requestOptions);
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<ManagementApiHttpResponse<List<PostConnectionsKeysResponseContentItem>>> create(
String id, OptionalNullable<PostConnectionKeysRequestContent> request) {
return create(id, request, null);
}

/**
* Provision initial connection keys for Okta or OIDC connection strategies. This endpoint allows you to create keys before configuring the connection to use Private Key JWT authentication, enabling zero-downtime transitions.
*/
public CompletableFuture<ManagementApiHttpResponse<List<PostConnectionsKeysResponseContentItem>>> create(
String id, OptionalNullable<PostConnectionKeysRequestContent> request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("connections")
.addPathSegment(id)
.addPathSegments("keys");
if (requestOptions != null) {
requestOptions.getQueryParameters().forEach((_key, _value) -> {
httpUrl.addQueryParameter(_key, _value);
});
}
RequestBody body;
try {
body = RequestBody.create("", null);
if (request.isPresent()) {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
}
} catch (JsonProcessingException e) {
throw new ManagementException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl.build())
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ManagementApiHttpResponse<List<PostConnectionsKeysResponseContentItem>>> 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,
new TypeReference<List<PostConnectionsKeysResponseContentItem>>() {}),
response));
return;
}
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
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 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),
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;
}

/**
* Rotates the connection keys for the Okta or OIDC connection strategies.
*/
Expand Down
Loading
Loading