Search in sources :

Example 71 with Client

use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.

the class UserBlocksEntity method deleteByIdentifier.

/**
 * Delete any existing User Blocks for a given identifier. A token with scope update:users is needed.
 * See https://auth0.com/docs/api/management/v2#!/User_Blocks/delete_user_blocks
 *
 * @param identifier the identifier. Either a username, phone_number, or email.
 * @return a Request to execute.
 */
public Request<Void> deleteByIdentifier(String identifier) {
    Asserts.assertNotNull(identifier, "identifier");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/user-blocks").addQueryParameter("identifier", identifier).build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 72 with Client

use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.

the class UsersEntity method deleteMultifactorProvider.

/**
 * Delete an existing User's Multifactor Provider.
 * A token with scope update:users is needed.
 * See https://auth0.com/docs/api/management/v2#!/Users/delete_multifactor_by_provider
 *
 * @param userId   the user id
 * @param provider the multifactor provider
 * @return a Request to execute.
 */
public Request<Void> deleteMultifactorProvider(String userId, String provider) {
    Asserts.assertNotNull(userId, "user id");
    Asserts.assertNotNull(provider, "provider");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/users").addPathSegment(userId).addPathSegment("multifactor").addPathSegment(provider).build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 73 with Client

use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.

the class ClientsEntity method delete.

/**
 * Delete an existing Application. A token with scope delete:clients is needed.
 * See https://auth0.com/docs/api/management/v2#!/Clients/delete_clients_by_id
 *
 * @param clientId the application's client id.
 * @return a Request to execute.
 */
public Request<Void> delete(String clientId) {
    Asserts.assertNotNull(clientId, "client id");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/clients").addPathSegment(clientId).build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 74 with Client

use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.

the class ConnectionsEntity method delete.

/**
 * Delete an existing Connection. A token with scope delete:connections is needed.
 * See https://auth0.com/docs/api/management/v2#!/Connections/delete_connections_by_id
 *
 * @param connectionId the connection id.
 * @return a Request to execute.
 */
public Request<Void> delete(String connectionId) {
    Asserts.assertNotNull(connectionId, "connection id");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/connections").addPathSegment(connectionId).build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 75 with Client

use of com.auth0.json.mgmt.client.Client in project auth0-java by auth0.

the class DeviceCredentialsEntity method delete.

/**
 * Delete an existing Device Credentials. A token with scope delete:device_credentials is needed.
 * See https://auth0.com/docs/api/management/v2#!/Device_Credentials/post_device_credentials
 *
 * @param deviceCredentialsId the device credentials id
 * @return a Request to execute.
 */
public Request<Void> delete(String deviceCredentialsId) {
    Asserts.assertNotNull(deviceCredentialsId, "device credentials id");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/device-credentials").addPathSegment(deviceCredentialsId).build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader("Authorization", "Bearer " + apiToken);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Aggregations

IOException (java.io.IOException)36 APIException (com.auth0.exception.APIException)27 Auth0Exception (com.auth0.exception.Auth0Exception)27 RateLimitException (com.auth0.exception.RateLimitException)27 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)26 List (java.util.List)25 Test (org.junit.Test)25 VoidRequest (com.auth0.net.VoidRequest)24 TokenHolder (com.auth0.json.auth.TokenHolder)22 JsonParseException (com.fasterxml.jackson.core.JsonParseException)19 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)19 ExpectedException (org.junit.rules.ExpectedException)19 RecordedMultipartRequest (com.auth0.net.multipart.RecordedMultipartRequest)16 Test (org.junit.jupiter.api.Test)14 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)14 DecodedJWT (com.auth0.jwt.interfaces.DecodedJWT)13 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)9 AuthAPI (com.auth0.client.auth.AuthAPI)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)7 OkHttpClient (okhttp3.OkHttpClient)7