WebSphere Portal Server - Using jsf to get SSO Ltpa-token exception - The internal portlet

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > January 2007 > Using jsf to get SSO Ltpa-token exception - The internal portlet





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Using jsf to get SSO Ltpa-token exception - The internal portlet

2007-01-22, 7:21 am

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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com