Search in sources :

Example 6 with Scope

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

the class OrganizationsEntity method deleteMembers.

/**
 * Delete members from an organization. A token with {@code delete:organization_members} scope is required.
 *
 * @param orgId the ID of the organization
 * @param members The members to remove
 * @return a Request to execute
 *
 * @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/delete_members">https://auth0.com/docs/api/management/v2#!/Organizations/delete_members</a>
 */
public Request<Void> deleteMembers(String orgId, Members members) {
    Asserts.assertNotNull(orgId, "organization ID");
    Asserts.assertNotNull(members, "members");
    String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).addPathSegment("members").build().toString();
    VoidRequest request = new VoidRequest(client, url, "DELETE");
    request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
    request.setBody(members);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 7 with Scope

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

the class BlacklistsEntity method blacklistToken.

/**
 * Add a Token to the Blacklist. A token with scope blacklist:tokens is needed.
 * See https://auth0.com/docs/api/management/v2#!/Blacklists/post_tokens.
 *
 * @param token the token to blacklist.
 * @return a Request to execute.
 */
public Request<Void> blacklistToken(Token token) {
    Asserts.assertNotNull(token, "token");
    String url = baseUrl.newBuilder().addPathSegments("api/v2/blacklists/tokens").build().toString();
    VoidRequest request = new VoidRequest(client, url, "POST");
    request.addHeader("Authorization", "Bearer " + apiToken);
    request.setBody(token);
    return request;
}
Also used : VoidRequest(com.auth0.net.VoidRequest)

Example 8 with Scope

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

the class ClientGrantsEntity method delete.

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

Example 9 with Scope

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

the class ConnectionsEntity method deleteUser.

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

Example 10 with Scope

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

the class EmailProviderEntity method delete.

/**
 * Delete the existing Email Provider. A token with scope delete:email_provider is needed.
 * See https://auth0.com/docs/api/management/v2#!/Emails/delete_provider
 *
 * @return a Request to execute.
 */
public Request<Void> delete() {
    String url = baseUrl.newBuilder().addPathSegments("api/v2/emails/provider").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