use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class RulesConfigsEntity method delete.
/**
* Delete an existing Rules Config. A token with scope delete:rules_configs is needed.
* See https://auth0.com/docs/api/management/v2#!/Rules_Configs/delete_rules_configs_by_key
*
* @param rulesConfigKey the rules config key
* @return a Request to execute.
*/
public Request<Void> delete(String rulesConfigKey) {
Asserts.assertNotNull(rulesConfigKey, "rules config key");
String url = baseUrl.newBuilder().addPathSegments("api/v2/rules-configs").addPathSegment(rulesConfigKey).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class RulesEntity method delete.
/**
* Delete an existing Rule. A token with scope delete:rules is needed.
* See https://auth0.com/docs/api/management/v2#!/Rules/delete_rules_by_id
*
* @param ruleId the rule id
* @return a Request to execute.
*/
public Request<Void> delete(String ruleId) {
Asserts.assertNotNull(ruleId, "rule id");
String url = baseUrl.newBuilder().addPathSegments("api/v2/rules").addPathSegment(ruleId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class AuthAPI method buildNetworkingClient.
/**
* Given a set of options, it creates a new instance of the {@link OkHttpClient}
* configuring them according to their availability.
*
* @param options the options to set to the client.
* @return a new networking client instance configured as requested.
*/
private OkHttpClient buildNetworkingClient(HttpOptions options) {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
final ProxyOptions proxyOptions = options.getProxyOptions();
if (proxyOptions != null) {
// Set proxy
clientBuilder.proxy(proxyOptions.getProxy());
// Set authentication, if present
final String proxyAuth = proxyOptions.getBasicAuthentication();
if (proxyAuth != null) {
clientBuilder.proxyAuthenticator(new Authenticator() {
private static final String PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization";
@Override
public okhttp3.Request authenticate(Route route, Response response) throws IOException {
if (response.request().header(PROXY_AUTHORIZATION_HEADER) != null) {
return null;
}
return response.request().newBuilder().header(PROXY_AUTHORIZATION_HEADER, proxyAuth).build();
}
});
}
}
configureLogging(options.getLoggingOptions());
Dispatcher dispatcher = new Dispatcher();
dispatcher.setMaxRequests(options.getMaxRequests());
dispatcher.setMaxRequestsPerHost(options.getMaxRequestsPerHost());
return clientBuilder.addInterceptor(logging).addInterceptor(telemetry).connectTimeout(options.getConnectTimeout(), TimeUnit.SECONDS).readTimeout(options.getReadTimeout(), TimeUnit.SECONDS).dispatcher(dispatcher).build();
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class ActionsEntity method delete.
/**
* Delete an action and all of its associated versions. A token with {@code delete:action} scope is required.
*
* @param actionId the ID of the action to delete.
* @param force whether to force the action deletion even if it is bound to triggers.
* @return a request to execute.
*
* <a href="https://auth0.com/docs/api/management/v2#!/Actions/get_triggers">https://auth0.com/docs/api/management/v2#!/Actions/get_triggers</a>
*/
public Request<Void> delete(String actionId, boolean force) {
Asserts.assertNotNull(actionId, "action ID");
String url = baseUrl.newBuilder().addPathSegments(ACTIONS_BASE_PATH).addPathSegment(ACTIONS_PATH).addPathSegment(actionId).addQueryParameter("force", String.valueOf(force)).build().toString();
VoidRequest voidRequest = new VoidRequest(client, url, "DELETE");
voidRequest.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
return voidRequest;
}
use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.
the class UserBlocksEntity method delete.
/**
* Delete any existing User Blocks. A token with scope update:users is needed.
* See https://auth0.com/docs/api/management/v2#!/User_Blocks/delete_user_blocks_by_id
*
* @param userId the user id.
* @return a Request to execute.
*/
public Request<Void> delete(String userId) {
Asserts.assertNotNull(userId, "user id");
String url = baseUrl.newBuilder().addPathSegments("api/v2/user-blocks").addPathSegment(userId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
Aggregations