Here is some code that I wrote to get this value in the legacy API:
public static void getCredential(PortletRequest portletRequest, WorkloadIndexPortletSessionBean sessionBean, StringBuffer userid, StringBuffer password)
throws PortletException
{
if(4 == sessionBean.getSecretType())
{
Subject subject = vaultService.getUserSubject(portletRequest);
if(subject != null)
{
userid.append(getPrincipalFromSubject(subject, "com.ibm.wps.sso.UserIdPrincipal"));
password.append(getPrincipalFromSubject(subject, "com.ibm.wps.sso.PasswordCredential"));
}
} else
{
String slotId = getSlotId(portletRequest, sessionBean, false);
if(slotId != null)
{
UserPasswordPassiveCredential credential = (UserPasswordPassiveCredential)vaultService.getCredential(slotId, "UserPasswordPassive", new HashMap(), portletRequest);
if(credential != null)
{
userid.append(credential.getUserId());
password.append(String.valueOf(credential.getPassword()));
}
}
}
}
You can also look at this for some direction:
http://www.ibm.com/developerworks/websphere/library/techarticles/0211_konduru/konduru.html
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.