Bryan Kearney
2010-Jun-22 11:35 UTC
[libvirt-users] Question about the remote Authentication in the libvirt Java bindings
Dustin: I am adding this response to the libvirt list as well so that others may see it. The authorization is done via a callback. The ConnectAuthDefault() that you are using is one such implementation. You could create your own subclass of ConnectAuth, and override the method: public abstract int callback(Credential[] cred); And then provide the username/password in that fashion. Look at the ConnectAuthDefault in the case statement how it chooses to ask for username and password. -- bk On 06/21/2010 10:35 PM, Dustin Xiong wrote:> Dear Bryan Kearney? > > I hava a question about the remote authentication of the libvirt java > bindings. I run the test.java of the libvirt-java-0.4.3.tar.gz. I can > connect the remote host use the > > ConnectAuth defaultAuth = new ConnectAuthDefault(); > try{ conn = new Connect("xen+ssh://192.168.0.146/", defaultAuth, 0); > > Then I input the remote host's ssh password, I can connect the host. > If I don't want to input the ssh password, I want write the password > into the libvirt or libvirt-java' src code. > How can modify the libvirt or libvirt-java src code, the libvirt will > auto connect to the remote host without user input the ssh code. > > Thanks for help. > > -Dustin