/** * Override this method to add/enable security to the rest request specification. * example:<br> * <code> * public Response execute(){ * spec.auth().preemptive().basic(user, password); * return execute(endPoint); * } * </code> * @return */ public Response execute() { LOG.debug("server: " + server); LOG.debug("method: " + method); LOG.debug("endpoint: " + endPoint); //System.out.println("url parameters: " + ToteUtils.getListAsString(urlParams)); //assemble(); // if(headerList!=null&&headerList.size()>0) { // spec.headers(headerList); // } spec.auth().none(); Response result = execute(endPoint); return result; }
private static RequestSpecification authenticatedRequest(TestAuthentication authentication) { RequestSpecification builder = jsonRequest(); if (authentication.isAuthenticated()) { builder.auth().preemptive().basic(authentication.getUsername(), authentication.getPassword()); } else { builder.auth().none(); } return builder; }