Wednesday, June 10, 2009

How to get WCM/WP User Info in WCM

Create a JSP component with the following code:

<%@page import="java.util.*,*,*,*,
java.text.*, javax.servlet.http.*"%>

Principal userPrincipal = (Principal) request.getSession().getAttribute("wcm_session_user"); pumauser = ( userPrincipal;
String givenName = (String) pumauser.getGivenName();
String familyName = (String) pumauser.getFamilyName();
if (givenName == null) givenName = "";
if (familyName == null) familyName = "";
out.print(givenName + " " + familyName);


1 comment:

rifaccio said...

is it possible to use Puma API and an jsp page to execute a login in a site?
I 've a need to create a login for a site in WCM in order to show some content on registered user and some other to nono logged.