rest-assured/src/main/java/io/restassured/authentication/PreemptiveAuthProvider.java
public AuthenticationScheme basic(String userName, String password) {
        final PreemptiveBasicAuthScheme preemptiveBasicAuthScheme = new PreemptiveBasicAuthScheme();
        preemptiveBasicAuthScheme.setUserName(userName);
        preemptiveBasicAuthScheme.setPassword(password);
        return preemptiveBasicAuthScheme;
    }
public AuthenticationScheme basic(String userName, String password) {
        final PreemptiveBasicAuthScheme preemptiveBasicAuthScheme = new PreemptiveBasicAuthScheme();
        preemptiveBasicAuthScheme.setUserName(userName);
        preemptiveBasicAuthScheme.setPassword(password);
        return preemptiveBasicAuthScheme;
    }
public AuthenticationScheme basic ( String userName , String password ) { final PreemptiveBasicAuthScheme preemptiveBasicAuthScheme = new PreemptiveBasicAuthScheme ( ) ; preemptiveBasicAuthScheme . setUserName ( userName ) ; preemptiveBasicAuthScheme . setPassword ( password ) ; return preemptiveBasicAuthScheme ; }
Use preemptive http basic authentication. This means that the authentication details are sent in the request
header regardless if the server has challenged for authentication or not.

@param userName The user name.
@param password The password.

@return The Request specification
Use preemptive http basic authentication . This means that the authentication details are sent in the request header regardless if the server has challenged for authentication or not .