protected void addCredentials()

in src/main/java/com/epam/dep/esp/common/web/Web.java [171:180]


    protected void addCredentials(HttpRequestBase httpRequest, Credentials credentials) {
        if (credentials == null) return;
        if (credentials instanceof UsernamePasswordCredentials) {
            //Add base http credentials
            String auth = credentials.getUserPrincipal().getName() + ":" + credentials.getPassword();
            byte[] encodedAuth = Base64.encodeBase64(auth.getBytes());
            String authHeader = "Basic " + new String(encodedAuth);
            httpRequest.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
        }
    }