01-22-07 12:21 PM
Hi all,
Using Portal v.6.0.0.1.
Normally when you want a portlet to access a ltpatoken from the credential v
ault, 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/c
om.ibm.portal.portlet.service.credentialvault.CredentialVaultService");
CredentialVaultService cvService = (CredentialVaultService)cvHome.getPortlet
Service(CredentialVaultService.class);
Subject sub = cvService.getUserSubject(request);
if (sub != null) {
Iterator privKey=sub. getPrivateCredentials(LTPATokenCredentia
l.class).iterat
or();
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 adress
able directly you use the FacesContext to get the PortletRequest - PortletRe
quest request = (PortletRequest) FacesContext.getCurrentInstance().getExtern
alContext().getRequest();
But using this to get the PortletRequest throws a IllegalStateException - Th
e internal portlet request cannot be found. (pointing to "Subject sub = cvSe
rvice.getUserSubject(request);")
So what am I doing wrong? Is there a "feature" i miss in the jsf-spec?
Thanks in advance,
/Jonas V
[ Post a follow-up to this message ]
|