private void addCredentialsProvider(HttpClientBuilder builder) throws TikaConfigException {

        if (StringUtils.isBlank(userName) && StringUtils.isBlank(password)) {
            return;
        }

        if ((StringUtils.isBlank(userName) && StringUtils.isBlank(password)) ||
                (StringUtils.isBlank(password) && StringUtils.isBlank(userName))) {
            throw new IllegalArgumentException(
                    "can't have one of 'username', " + "'password' null and the other not");
        }

        String finalUserName = decrypt(userName);
        String finalPassword = decrypt(password);
        String finalDomain = decrypt(ntDomain);
        CredentialsProvider provider = new BasicCredentialsProvider();
        Credentials credentials = null;
        Registry<AuthSchemeProvider> authSchemeRegistry = null;
        if (authScheme.equals("basic")) {
            credentials = new UsernamePasswordCredentials(finalUserName, finalPassword);
            authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
                    .register("basic", new BasicSchemeFactory()).build();
        } else if (authScheme.equals("ntlm")) {
            if (StringUtils.isBlank(ntDomain)) {
                throw new IllegalArgumentException("must specify 'ntDomain'");
            }
            credentials = new NTCredentials(finalUserName, finalPassword,
                    null, finalDomain);
            authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
                    .register("ntlm", new NTLMSchemeFactory()).build();
        }
        if (credentials != null) {
            provider.setCredentials(AuthScope.ANY, credentials);
        }
        builder.setDefaultCredentialsProvider(provider);
        builder.setDefaultAuthSchemeRegistry(authSchemeRegistry);

    }
only basic and ntlm are supported

@param authScheme
tika-pipes/tika-httpclient-commons/src/main/java/org/apache/tika/client/HttpClientFactory.java