use of com.hw.helper.EndpointInfo in project mt-auth by publicdevop2019.
the class EndpointTest method create_new_endpoint_then_delete.
@Test
public void create_new_endpoint_then_delete() {
EndpointInfo endpointInfo1 = new EndpointInfo();
endpointInfo1.setResourceId("0C8AZTODP4HT");
endpointInfo1.setUserRoles(new HashSet<>(List.of("ROLE_ADMIN")));
endpointInfo1.setUserOnly(true);
endpointInfo1.setName("test");
endpointInfo1.setMethod("GET");
endpointInfo1.setWebsocket(false);
endpointInfo1.setPath("/test/" + UUID.randomUUID().toString().replace("-", "").replaceAll("\\d", "") + "/abc");
ResponseEntity<String> profile = createProfile(endpointInfo1);
Assert.assertEquals(HttpStatus.OK, profile.getStatusCode());
ResponseEntity<String> stringResponseEntity = deleteProfile(profile.getHeaders().getLocation().toString());
Assert.assertEquals(HttpStatus.OK, stringResponseEntity.getStatusCode());
}
use of com.hw.helper.EndpointInfo in project mt-auth by publicdevop2019.
the class GatewayFilterTest method should_sanitize_request_json.
@Test
// move this feature to individual application level
@Ignore
public void should_sanitize_request_json() {
EndpointInfo endpointInfo1 = new EndpointInfo();
endpointInfo1.setResourceId("0C8AZTODP4HT");
endpointInfo1.setSecured(false);
endpointInfo1.setMethod("GET");
endpointInfo1.setName("Test");
endpointInfo1.setDescription("<script>test</script>");
endpointInfo1.setPath("/test/" + UUID.randomUUID().toString().replace("-", "").replaceAll("\\d", "") + "/abc");
ResponseEntity<String> profile = createProfile(endpointInfo1);
String s = profile.getHeaders().getLocation().toString();
Assert.assertEquals(HttpStatus.OK, profile.getStatusCode());
ResponseEntity<EndpointInfo> securityProfileResponseEntity = readProfile(s);
Assert.assertEquals("<script>test</script>", securityProfileResponseEntity.getBody().getDescription());
}
Aggregations