/** * Use http digest authentication. Note that you need to encode the password yourself. * * @param userName The user name. * @param password The password. * @return The authentication scheme */ public static AuthenticationScheme digest(String userName, String password) { return basic(userName, password); }
@BeforeClass static public void setup() throws MalformedURLException { // set base URI and port number to use for all requests String serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; // set user name and password to use for basic authentication for all requests String userName = System.getProperty("test.user"); String password = System.getProperty("test.pwd"); if (userName != null && password != null) { RestAssured.authentication = RestAssured.basic(userName, password); RestAssured.useRelaxedHTTPSValidation(); } }
@BeforeClass static public void setup() throws MalformedURLException { // set base URI and port number to use for all requests String serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; // set user name and password to use for basic authentication for all requests String userName = System.getProperty("test.user"); String password = System.getProperty("test.pwd"); if (userName != null && password != null) { RestAssured.authentication = RestAssured.basic(userName, password); RestAssured.useRelaxedHTTPSValidation(); } }