Search in sources :

Example 31 with Scope

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

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

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

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

Example 35 with Scope

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

the class RequestProcessorTest method shouldBuildAuthorizeUrlWithFormPostIfResponseTypeIsToken.

@Test
public void shouldBuildAuthorizeUrlWithFormPostIfResponseTypeIsToken() {
    AuthAPI client = new AuthAPI("me.auth0.com", "clientId", "clientSecret");
    RequestProcessor handler = new RequestProcessor.Builder(client, "token", verifyOptions).build();
    HttpServletRequest request = new MockHttpServletRequest();
    AuthorizeUrl builder = handler.buildAuthorizeUrl(request, response, "https://redirect.uri/here", "state", "nonce");
    String authorizeUrl = builder.build();
    assertThat(authorizeUrl, is(notNullValue()));
    assertThat(authorizeUrl, CoreMatchers.startsWith("https://me.auth0.com/authorize?"));
    assertThat(authorizeUrl, containsString("client_id=clientId"));
    assertThat(authorizeUrl, containsString("redirect_uri=https://redirect.uri/here"));
    assertThat(authorizeUrl, containsString("response_type=token"));
    assertThat(authorizeUrl, containsString("scope=openid"));
    assertThat(authorizeUrl, containsString("state=state"));
    assertThat(authorizeUrl, containsString("response_mode=form_post"));
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) AuthAPI(com.auth0.client.auth.AuthAPI) Test(org.junit.jupiter.api.Test)

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