Skip to main content

developerWorks >  WebSphere  >  Forums  >  WebSphere JavaServer Faces (JSF)  >  developerWorks

WPS 5.0 JSR 168 JSF Portlet logged in username?    Point your RSS reader here for a feed of the latest messages in this thread


Tags for this thread: 

     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
This question is not answered.

Permlink Replies: 6 - Pages: 1 - Last Post: Nov 5, 2009 6:52 AM Last Post By: _SerpentOS
_SerpentOS

Posts: 25
Registered: Dec 13, 2004 09:12:09 AM
WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 07:12:25 PM
 
Click to report abuse...   Click to reply to this thread Reply
Hi,
While building a JSR 168 JSF portlet on WPS 5.0 I'm unable to get the logged in username.

I can't find documentation on where the user information is stored, comparing it to Struts portlets I have something like this in struts version

String userId = pRequest.getUser().getUserID();


Where pRequest is an instance of
org.apache.jetspeed.portlet.PortletRequest


however I'm in search for a comparable parameter in JSF version and I don't seem to find any.

Thanks in advance.
_SerpentOS

Posts: 25
Registered: Dec 13, 2004 09:12:09 AM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 07:50:39 PM   in response to: _SerpentOS in response to: _SerpentOS's post
 
Click to report abuse...   Click to reply to this thread Reply
Out of desperation I'm listing the output of my attempts here,
all marked with ##########MASKED######### are application specific and insignificant

ExternalContext.getUserPrinicipal() : null
ExternalContext.getRemoteUser: null;

ExternalContext.Maps
O ###########Dumping Map: RequestHeaderMap
O Key <accept-language> Value <en-us,en;q=0.5>
O Key <wps.markup> Value <html>
O Key <content-type> Value <application/x-www-form-urlencoded>
O Key <accept-encoding> Value <gzip,deflate>
O Key <user-agent> Value <Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729)>
O Key <cookie> Value <GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; LOGIN=6272756e6f4037636f67732e636f6d; SCREEN_NAME=6d6a4b4a6a616e795670303d; JSESSIONID=0000j5WQt_ktcoGWq-5uqVLAQ20:-1>
O Key <content-length> Value <359>
O Key <accept-charset> Value <ISO-8859-1,utf-8;q=0.7,*;q=0.7>
O Key <connection> Value <keep-alive>
O Key <host> Value <localhost:9081>
O Key <accept> Value <text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8>
O Key <referer> Value <http://localhost:9081/wps/myportal/!ut/p/_s.7_0_A/7_0_1A95?cID=6_0_3S&nID=7_0_5L>
O Key <keep-alive> Value <300>
O ########################################
O ###########Dumping Map: RequestMap
O Key <DEFAULT> Value <com.sun.faces.lifecycle.LifecycleImpl@6af56af5>
O Key <com.ibm.faces.FACES_CONTEXT> Value <com.ibm.faces.context.PortletFacesContextImpl@15841584>
O Key <varuserList> Value <##########MASKED#########@623d623d>
O Key <com.ibm.faces.CONTEXT_FACTORY> Value <com.ibm.faces.context.PortletFacesContextFactoryImpl@5d635d63>
O Key <pc_##########MASKED#########> Value <pagecode.##########MASKED#########@67586758>
O Key <com.ibm.faces.LIFECYCLE_FACTORY> Value <com.sun.faces.lifecycle.LifecycleFactoryImpl@8580858>
O Key <javax.portlet.userinfo> Value <null>
O Key <com.ibm.faces.webapp.PortletConstants_LIFECYCLE_RUN> Value <com.ibm.faces.webapp.PortletConstants_LIFECYCLE_RUN>
O ########################################
O ###########Dumping Map: SessionMap
O Key <javax.portlet.p.7_0_1A9A?javax.faces.request.charset> Value <null>
O Key <javax.portlet.p.7_0_1A9A?com.sun.faces.VIEW_LIST> Value <null>
O Key <javax.portlet.p.7_0_1A9B?com.ibm.faces.portlet.page.view> Value <null>
O Key <javax.portlet.p.7_0_1A9A?sessionBean> Value <null>
O Key <javax.portlet.p.7_0_1A9A?com.ibm.faces.portlet.page.view> Value <null>
O Key <javax.portlet.p.7_0_1A9B?com.ibm.faces.portlet.CURRENT_PORTLET_ID> Value <null>
O Key <javax.portlet.p.7_0_1A9A?com.ibm.faces.portlet.CURRENT_PORTLET_ID> Value <null>
O Key <javax.portlet.p.7_0_1A9A?/##########MASKED#########.jsp> Value <null>
O Key <javax.portlet.p.7_0_1A9B?/##########MASKED#########jsp> Value <null>
O Key <javax.portlet.p.7_0_1A9B?com.sun.faces.VIEW_LIST> Value <null>
O Key <javax.portlet.p.7_0_1A9B?javax.faces.request.charset> Value <null>
O Key <javax.portlet.p.7_0_1A9B?##########MASKED#########SessionBean> Value <null>
O ########################################
O ###########Dumping Map: RequestCookieMap
O ########################################
O ###########Dumping Map: InitParameterMap
O Key <com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP> Value <true>
O Key <com.ibm.ws.jsf.JSP_UPDATE_CHECK> Value <true>
O ########################################
IBM employee or contractor yurykats

Posts: 2,464
Registered: Aug 02, 2004 10:15:53 PM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 09:47:56 PM   in response to: _SerpentOS in response to: _SerpentOS's post
 
Click to report abuse...   Click to reply to this thread Reply
FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal()?
_SerpentOS

Posts: 25
Registered: Dec 13, 2004 09:12:09 AM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 09:58:08 PM   in response to: Yury Kats(yurykats) in response to: Yury Kats(yurykats)'s post
 
Click to report abuse...   Click to reply to this thread Reply
Hello Yury, please recheck my message I already mentioned that
FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal()?

returns null

Do you suspect a configuration issue then?
_SerpentOS

Posts: 25
Registered: Dec 13, 2004 09:12:09 AM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 11:26:41 PM   in response to: _SerpentOS in response to: _SerpentOS's post
 
Click to report abuse...   Click to reply to this thread Reply
Another direction was to extend the FacesGenericPortlet much like WPFacesGenericPortlet (non JSR168), strange enough
doLogin(PortletRequest) from non JSR168 version has no equivalent in the JSR168 version. while they are both IBM implementations

com.ibm.faces.webapp.FacesGenericPortlet

and
com.ibm.faces.webapp.WPFacesGenericPortlet


unfortunately the non-jsr168 version has the method
doLogin(PortletRequest)
which actually works and retrieves the user information via
portletRequest.getUser().getUserId()


is there any comparable API for the "Standard" JSR168 version ?

regards
IBM employee or contractor yurykats

Posts: 2,464
Registered: Aug 02, 2004 10:15:53 PM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 04, 2009 11:37:53 PM   in response to: _SerpentOS in response to: _SerpentOS's post
 
Click to report abuse...   Click to reply to this thread Reply
FacesContext.getCurrentInstance().getExternalContext().getRequest() and then use PortletRequest API from there? That should not be different from what you do in Struts, although the classname you mentioned is not a JSR168 class, I think.

Are you sure you are actually logged in?
_SerpentOS

Posts: 25
Registered: Dec 13, 2004 09:12:09 AM
Re: WPS 5.0 JSR 168 JSF Portlet logged in username?
Posted: Nov 05, 2009 06:52:09 AM   in response to: Yury Kats(yurykats) in response to: Yury Kats(yurykats)'s post
 
Click to report abuse...   Click to reply to this thread Reply
I'm positive about logging in as all portlets and their pages are only granted to specific user groups.
I'm seeing these symptoms on the Portal 5.0 test environment,
will attempt to deploy to 5.0.2 at staging and check hoping that a misconfiguration can be the cause of all this.

Still, I take from your answer that this is as confusing to you as it's to me
and possibly it will turn out to be a framework implementation bug.

Best regards.
ZizoV
 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums