|
| Hi all,
Using Portal v.6.0.0.1.
Normally when you want a portlet to access a ltpatoken from the credential vault, you can use the following stubcode (mind you, this is just an example-code):
import javax.naming.Context;
import javax.naming.InitialContext;
import com.ibm.wps.sso.LTPATokenCredential;
import com.ibm.portal.portlet.service.credentialvault.CredentialVaultService;
import com.ibm.portal.portlet.service.PortletServiceHome;
....
getLTPAToken(PortletRequest request) {
Context ctx = new InitialContext();
PortletServiceHome cvHome = (PortletServiceHome)ctx.lookup("portletservice/com.ibm.portal.portlet.service.credentialvault.CredentialVaultService");
CredentialVaultService cvService = (CredentialVaultService)cvHome. getPortletService(CredentialVaultService
.class);
Subject sub = cvService.getUserSubject(request);
if (sub != null) {
Iterator privKey=sub. getPrivateCredentials(LTPATokenCredentia
l.class).iterator();
LTPATokenCredential token = null;
if(privKey.hasNext()) {
return (LTPATokenCredential) privKey.next();
}
}
return null;
}
If you would've configured SSO, the returned class contains a Ltpa-key.
And it does, <B>but not when using jsf</B>. Since the request are not adressable directly you use the FacesContext to get the PortletRequest - PortletRequest request = (PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
But using this to get the PortletRequest throws a IllegalStateException - The internal portlet request cannot be found. (pointing to "Subject sub = cvService.getUserSubject(request);")
So what am I doing wrong? Is there a "feature" i miss in the jsf-spec?
Thanks in advance,
/Jonas V
|
|