The code examples in the following sections show how to use the Issue method to acquire a holder-of-key security token. To see an example of using the token to login to a vCenter server, see LoginByToken Example (JAX-WS). The code examples in this chapter are based on the following sample file located in the vCenter Single Sign-On SDK JAX-WS client samples directory:
.../JAXWS/samples/com/vmware/sso/client/samples/AcquireHoKTokenByUserCredentialSample.java
The AcquireHoKTokenByUserCredentialSample program creates a token request and calls the issue method to send the request to a vCenter Single Sign-On server. The program uses a sample implementation of Web services message handlers to modify the SOAP security header for the request message.
This example uses the username-password security policy (STSSecPolicy_UserPwd). This policy requires that the SOAP security header include a timestamp, username and password, and a digital signature and certificate. The sample message handlers embed these elements in the message.
The example performs the following operations: