Search in sources :

Example 26 with Scope

use of com.auth0.json.mgmt.Scope 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;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 27 with Scope

use of com.auth0.json.mgmt.Scope 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;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 28 with Scope

use of com.auth0.json.mgmt.Scope 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;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 29 with Scope

use of com.auth0.json.mgmt.Scope 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;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 30 with Scope

use of com.auth0.json.mgmt.Scope 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)

Aggregations

VoidRequest (com.auth0.net.VoidRequest)24 Test (org.junit.Test)4 AuthAPI (com.auth0.client.auth.AuthAPI)3 Date (java.util.Date)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)3 Test (org.junit.jupiter.api.Test)3 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)3 ClientGrant (com.auth0.json.mgmt.ClientGrant)2 JWT (com.auth0.jwt.JWT)2 JWTCreator (com.auth0.jwt.JWTCreator)2 Algorithm (com.auth0.jwt.algorithms.Algorithm)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 JSONObject (org.json.simple.JSONObject)2 ResourceServer (com.auth0.json.mgmt.ResourceServer)1 Scope (com.auth0.json.mgmt.Scope)1 JwkProvider (com.auth0.jwk.JwkProvider)1 JwkProviderBuilder (com.auth0.jwk.JwkProviderBuilder)1