private void unregisterEndpointExample(String service, String endpoint) throws UnsupportedEncodingException { System.out.println("------------------------------"); System.out.println("Unregister endpoint"); System.out.println("ServiceName: ".concat(service)); System.out.println("EndpointURL: ".concat(endpoint)); WebClient wc = WebClient.create(BASE_ADDRESS.concat("/") .concat(URLEncoder.encode(service, "UTF-8")).concat("/") .concat(URLEncoder.encode(endpoint, "UTF-8"))); try { wc.delete(); } catch (WebApplicationException ex) { System.err.println(ex.getResponse().getStatus() + ": " + ex.getMessage()); } }
public void doRemove(BaseResource resource) throws Exception { Response r = null; Exception failure = null; try { WebClient delete = getClient(resource.getHref()); r = delete.path("/").delete(); } catch (Exception e) { failure = e; } int expectedStatus = 204; if (failure != null || r.getStatus() != expectedStatus) { diagnose("remove failed with ", failure, r, expectedStatus); } else { System.out.println("remove succeeded"); } }
@Before public void setUp() { final Response r = createWebClient("/bookstore/books").delete(); assertEquals(Status.OK.getStatusCode(), r.getStatus()); }
@Before public void setUp() { final Response r = createWebClient("/bookstore/books").delete(); assertEquals(Status.OK.getStatusCode(), r.getStatus()); }
@Before public void setUp() { createWebClient("/catalog").delete(); }
System.out.println("Removing member with ID of " + maxID); resp = wc.path("all").path(new Integer(maxID).toString()).delete();
client.delete(); } catch (NotFoundException e) { return;
client.delete(); } catch (NotFoundException e) { return;
@org.junit.Test public void testRegisterClientInitialAccessTokenCodeGrant() throws Exception { URL busFile = OIDCDynamicRegistrationTest.class.getResource("client.xml"); String address = "https://localhost:" + PORT + "/services/dynamicWithAt/register"; WebClient wc = WebClient.create(address, Collections.singletonList(new JsonMapObjectProvider()), busFile.toString()); wc.accept("application/json").type("application/json"); ClientRegistration reg = newClientRegistrationCodeGrant(); ClientRegistrationResponse resp = null; assertEquals(401, wc.post(reg).getStatus()); wc.authorization(new ClientAccessToken("Bearer", "123456789")); resp = wc.post(reg, ClientRegistrationResponse.class); assertNotNull(resp.getClientId()); assertNotNull(resp.getClientSecret()); assertEquals(address + "/" + resp.getClientId(), resp.getRegistrationClientUri()); String regAccessToken = resp.getRegistrationAccessToken(); assertNotNull(regAccessToken); wc.reset(); wc.path(resp.getClientId()); assertEquals(401, wc.get().getStatus()); wc.authorization(new ClientAccessToken("Bearer", regAccessToken)); ClientRegistration clientRegResp = wc.get(ClientRegistration.class); testCommonRegCodeGrantProperties(clientRegResp); assertNull(clientRegResp.getTokenEndpointAuthMethod()); assertEquals(200, wc.delete().getStatus()); }
@Test public void testRegisterClientTwoWayTLSClientIdBoundDynReg() throws Exception { String dynRegAddress = "https://localhost:" + PORT + "/oauth2Jwt/register"; WebClient wcDynReg = createDynRegWebClient(dynRegAddress); wcDynReg.accept("application/json").type("application/json"); ClientRegistration reg = newClientRegistration(); wcDynReg.authorization(new ClientAccessToken("Bearer", "123456789")); ClientRegistrationResponse resp = wcDynReg.post(reg, ClientRegistrationResponse.class); doTestTwoWayTLSClientIdBoundJwt(resp.getClientId()); // delete the client String regAccessToken = resp.getRegistrationAccessToken(); assertNotNull(regAccessToken); wcDynReg.path(resp.getClientId()); wcDynReg.authorization(new ClientAccessToken("Bearer", regAccessToken)); assertEquals(200, wcDynReg.delete().getStatus()); assertNotNull(regAccessToken); }
clientRegResp.getProperty(OAuthConstants.TLS_CLIENT_AUTH_SUBJECT_DN)); assertEquals(200, wc.delete().getStatus());
assertNull(clientRegResp.getRedirectUris()); assertEquals(200, wc.delete().getStatus());
assertNull(clientRegResp.getRedirectUris()); assertEquals(200, wc.delete().getStatus());