@@ -0,0 +1,1726 @@
+package org.libvirt;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0A%0A/**%0A * Modified ConnectAuthDefault, that takes the password in the ctor rather than prompting for it.%0A *%0A * @author stoty lstoll%0A */%0Apublic final class ConnectAuthPasswordProvided extends ConnectAuth %7B%0A%0A    private String password;%0A%0A    public ConnectAuthPasswordProvided(String password) %7B%0A        credType = new CredentialType%5B%5D %7B CredentialType.VIR_CRED_AUTHNAME, CredentialType.VIR_CRED_ECHOPROMPT,%0A                CredentialType.VIR_CRED_REALM, CredentialType.VIR_CRED_PASSPHRASE, CredentialType.VIR_CRED_NOECHOPROMPT %7D;%0A        this.password = password;%0A    %7D%0A%0A    @Override%0A    public int callback(Credential%5B%5D cred) %7B%0A        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));%0A        try %7B%0A            for (Credential c : cred) %7B%0A                String response = %22%22;%0A                switch (c.type) %7B%0A                    case VIR_CRED_USERNAME:%0A                    case VIR_CRED_AUTHNAME:%0A                    case VIR_CRED_ECHOPROMPT:%0A                    case VIR_CRED_REALM:%0A                        response = password;%0A                    case VIR_CRED_PASSPHRASE:%0A                    case VIR_CRED_NOECHOPROMPT:%0A                        response = password;%0A                        break;%0A                %7D%0A                if (response.equals(%22%22) && !c.defresult.equals(%22%22)) %7B%0A                    c.result = c.defresult;%0A                %7D else %7B%0A                    c.result = response;%0A                %7D%0A                if (c.result.equals(%22%22)) %7B%0A                    return -1;%0A                %7D%0A            %7D%0A        %7D catch (Exception e) %7B%0A            return -1;%0A        %7D%0A        return 0;%0A    %7D%0A%0A%7D%0A

Connect Auth impl. that can take password rather than prompt for it