There are some questions on the forums on OTN regarding *portlets* and getting the username from the portal.
It appears that since WebCenter PS3, you need to configure your container before the user principal is passed to your portlet. This is because WebCenter uses WSRP to consume portlets. WSRP allows us to configure security between the portlet and producer. By default WebCenter does not use this security and we need to tell the container that we want to pass the username over the SOAP call which is not secure.
Before WebCenter PS3 this was configured automicly because we used JSR 168 portlets. Now with JSR 286, our portlets are fully JSR 286 and WSRP compliant.
So, what do we need to do. It's very simple. Just add com.oracle.portlet.useWsrpUserContextForUserAuthenticationInfo to the Container Runtime Options in your portlet.xml. That's all you need to do. After this, you can use following code to retreive the username in your portlet.
In a managed bean:
Or from within a JSPX page (using EL)
That's it. I will also write a complete example that uses this technique in a portlet.