use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class GrantsEntity method delete.
/**
* Delete an existing Grant. A token with scope delete:grants is needed.
* See https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id<br>
*
* @param grantId The id of the grant to delete.
* @return a Request to execute.
*/
public Request<Void> delete(String grantId) {
Asserts.assertNotNull(grantId, "grant id");
final String url = baseUrl.newBuilder().addPathSegments("api/v2/grants").addPathSegment(grantId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class GrantsEntity method deleteAll.
/**
* Deletes all Grants of a given user. A token with scope delete:grants is needed.
* See https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id<br>
*
* @param userId The id of the user whose grants are deleted.
* @return a Request to execute.
*/
public Request<Void> deleteAll(String userId) {
Asserts.assertNotNull(userId, "user id");
final String url = baseUrl.newBuilder().addPathSegments("api/v2/grants").addQueryParameter("user_id", userId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class UsersEntity method removeRoles.
/**
* Remove roles from a user.
* A token with update:users is needed.
* See https://auth0.com/docs/api/management/v2#!/Users/delete_user_roles
*
* @param userId the user id
* @param roleIds a list of role ids to remove from the user
* @return a Request to execute
*/
public Request<Void> removeRoles(String userId, List<String> roleIds) {
Asserts.assertNotNull(userId, "user id");
Asserts.assertNotEmpty(roleIds, "role ids");
Map<String, List<String>> body = new HashMap<>();
body.put("roles", roleIds);
final String url = baseUrl.newBuilder().addPathSegments("api/v2/users").addPathSegments(userId).addPathSegments("roles").build().toString();
VoidRequest request = new VoidRequest(this.client, url, "DELETE");
request.setBody(body);
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class UsersEntity method removePermissions.
/**
* Remove permissions from a user.
* A token with update:users is needed.
* See https://auth0.com/docs/api/management/v2#!/Users/delete_permissions
*
* @param userId the user id
* @param permissions a list of permission objects to remove from the user
* @return a Request to execute
*/
public Request<Void> removePermissions(String userId, List<Permission> permissions) {
Asserts.assertNotNull(userId, "user id");
Asserts.assertNotEmpty(permissions, "permissions");
Map<String, List<Permission>> body = new HashMap<>();
body.put("permissions", permissions);
final String url = baseUrl.newBuilder().addPathSegments("api/v2/users").addPathSegments(userId).addPathSegments("permissions").build().toString();
VoidRequest request = new VoidRequest(this.client, url, "DELETE");
request.setBody(body);
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class UsersEntity method delete.
/**
* Delete an existing User.
* A token with scope delete:users is needed.
* See https://auth0.com/docs/api/management/v2#!/Users/delete_users_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/users").addPathSegment(userId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader("Authorization", "Bearer " + apiToken);
return request;
}
Aggregations