I would like to update this thread with solution so it may be helpful for others. The above standalone code works perfectly with vCD 5.1.2 version. I can able to login with SAML token.
Try to get the token with user certificate from your local keystore or default keystore. Below is the default keystore example
SecurityUtil userCert = SecurityUtil.generateKeyCertPair(); Element token = AcquireHoKTokenByUserCredentialSample.getToken(args, userCert.getPrivateKey(), userCert.getUserCert());
Note: It is still printing null value on token, but token details are shown correctly.
HOK Token received:[saml2:Assertion: null]
Token details:
AssertionId = _5cdf174a-7338-434f-a386-959c718c421c
Token type = Holder-Of-Key
Issued On = 2013-06-18T15:30:29.167Z