public class SsoConnection extends java.lang.Object implements Connection
AcquireHoKTokenByUserCredentialSample| Modifier and Type | Class and Description |
|---|---|
class |
SsoConnection.SSOLoginException
thrown when a login has failed for a reason
|
class |
SsoConnection.SSOLogoutException
thrown on logout when something fails
|
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
certFileName
You may optionally specify the system property sso.cert.file=/fully/qualified/path
to load your SSL cert from a file.
|
java.lang.String |
pkeyFileName
You may optionally specify the system property sso.pkey.file=/fully/qualified/path
to load your SSL private key from a file.
|
static java.lang.String |
SSO_URL |
| Constructor and Description |
|---|
SsoConnection() |
| Modifier and Type | Method and Description |
|---|---|
Connection |
connect() |
Connection |
disconnect()
properly disconnect the connection and set stale objects to "null" to help the garbage collector
in resource constrained environments.
|
void |
generate()
generates a new key and cert and caches them for next time.
|
java.lang.String |
getDefaultSsoUrl()
Generates a default SSO URL to use if none was supplied on the command line.
|
java.util.Map |
getHeaders()
the cached headers gleaned from the last connection atttempt
|
java.lang.String |
getHost() |
java.lang.String |
getPassword() |
java.lang.Integer |
getPort() |
com.vmware.vim25.ServiceContent |
getServiceContent() |
java.lang.String |
getServiceInstanceName() |
com.vmware.vim25.ManagedObjectReference |
getServiceInstanceReference()
A service instance reference used to boot strap the client
|
java.net.URL |
getSsoUrl()
Will attempt to return the SSO URL you set from the command line, if you forgot or didn't set one it
will call getDefaultSsoUrl to attempt to calculate what the URL should have been.
|
java.lang.String |
getUrl() |
java.net.URL |
getURL()
gets the URL used for this connection
|
java.lang.String |
getUsername() |
com.vmware.vim25.UserSession |
getUserSession() |
com.vmware.vim25.VimPortType |
getVimPort() |
com.vmware.vim25.VimService |
getVimService() |
boolean |
isConnected()
returns true if the connection is open, and hasn't timed out.
|
void |
loadUserCert()
Load a cached key and cert from the file system if no X509Certificate is present on the
file system, calls "generate"
|
org.w3c.dom.Element |
login()
returns the token used for login to SSO
|
void |
setPassword(java.lang.String password) |
com.vmware.vim25.VimService |
setupVimService(org.w3c.dom.Element token,
com.vmware.sso.client.soaphandlers.SSOHeaderHandler... handlers)
sets up a VIM service registering handlers and handler resolvers.
|
void |
setUrl(java.lang.String url) |
void |
setUsername(java.lang.String username) |
public static final java.lang.String SSO_URL
public final java.lang.String pkeyFileName
SecurityUtilpublic final java.lang.String certFileName
SecurityUtilpublic java.net.URL getSsoUrl()
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic java.lang.String getDefaultSsoUrl()
sso.host sso.port and
sso.path to construct a URL for the SSO server. These properties are all optional.
If no value is set sso.host will default to the url of the WS server (assuming SSO and WS are hosted on the same IP)
If no value is set sso.port will default to 7444
If no value is set, sso.path will default to /ims/STSService which may not be correct.
public void setUrl(java.lang.String url)
setUrl in interface Connectionpublic java.lang.String getUrl()
getUrl in interface Connectionpublic java.lang.String getHost()
getHost in interface Connectionpublic java.lang.Integer getPort()
getPort in interface Connectionpublic void setUsername(java.lang.String username)
setUsername in interface Connectionpublic java.lang.String getUsername()
getUsername in interface Connectionpublic void setPassword(java.lang.String password)
setPassword in interface Connectionpublic java.lang.String getPassword()
getPassword in interface Connectionpublic com.vmware.vim25.VimService getVimService()
getVimService in interface Connectionpublic com.vmware.vim25.VimPortType getVimPort()
getVimPort in interface Connectionpublic com.vmware.vim25.ServiceContent getServiceContent()
getServiceContent in interface Connectionpublic com.vmware.vim25.UserSession getUserSession()
getUserSession in interface Connectionpublic java.lang.String getServiceInstanceName()
getServiceInstanceName in interface Connectionpublic java.util.Map getHeaders()
getHeaders in interface Connectionpublic com.vmware.vim25.ManagedObjectReference getServiceInstanceReference()
getServiceInstanceReference in interface Connectionpublic org.w3c.dom.Element login()
public com.vmware.vim25.VimService setupVimService(org.w3c.dom.Element token,
com.vmware.sso.client.soaphandlers.SSOHeaderHandler... handlers)
token - - service tokenhandlers - - arbitrary number of handlersVimServicepublic Connection connect()
connect in interface Connectionpublic void loadUserCert()
public void generate()
public boolean isConnected()
isConnected in interface Connectionpublic Connection disconnect()
disconnect in interface Connectionpublic java.net.URL getURL()
getURL in interface Connection