public class LoginByTokenSample
extends java.lang.Object
Usage: run.bat com.vmware.vsphere.samples.LoginByTokenSample [sso url] [username] [password] [vCenter url]
| Modifier and Type | Field and Description |
|---|---|
static com.vmware.vim25.ManagedObjectReference |
SVC_INST_REF |
static com.vmware.vim25.VimPortType |
vimPort |
| Constructor and Description |
|---|
LoginByTokenSample() |
| Modifier and Type | Method and Description |
|---|---|
static void |
getCurrentTime()
This method retrieves the current time from the server and prints it.
|
static java.lang.String |
loginUsingSAMLToken(org.w3c.dom.Element token,
java.lang.String vcServerUrl,
java.security.PrivateKey privateKey,
java.security.cert.X509Certificate publicCert)
This method invokes the loginByToken method for authentication.
|
static void |
logout()
Disconnects the user session.
|
static void |
main(java.lang.String[] args) |
public static com.vmware.vim25.VimPortType vimPort
public static com.vmware.vim25.ManagedObjectReference SVC_INST_REF
public static void getCurrentTime()
public static java.lang.String loginUsingSAMLToken(org.w3c.dom.Element token,
java.lang.String vcServerUrl,
java.security.PrivateKey privateKey,
java.security.cert.X509Certificate publicCert)
throws com.vmware.vim25.RuntimeFaultFaultMsg,
com.vmware.vim25.InvalidLocaleFaultMsg,
com.vmware.vim25.InvalidLoginFaultMsg
token - Element representing the SAML token that needs to be
used for the authenticationvcServerUrl - The vCenter server url that needs to be connectedprivateKey - PrivateKey of the user. Only required when using HoK
token to loginpublicCert - X509Certificate certificate of the user. Only required
when using HoK token to logincom.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.InvalidLocaleFaultMsgcom.vmware.vim25.InvalidLoginFaultMsgpublic static void logout()
throws com.vmware.vim25.RuntimeFaultFaultMsg
com.vmware.vim25.RuntimeFaultFaultMsgpublic static void main(java.lang.String[] args)
throws javax.xml.datatype.DatatypeConfigurationException,
com.vmware.vim25.RuntimeFaultFaultMsg,
com.vmware.vim25.InvalidLocaleFaultMsg,
com.vmware.vim25.InvalidLoginFaultMsg
javax.xml.datatype.DatatypeConfigurationExceptioncom.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.InvalidLocaleFaultMsgcom.vmware.vim25.InvalidLoginFaultMsg