First add these entries in
<user-attribute>
<description xml:lang="en">User Given Name</description>
<name>user.name.given</name>
</user-attribute>
<user-attribute>
<description xml:lang="en">User Last name</description>
<name>user.name.family</name>
</user-attribute>
After that you should be able to access those two attributes in your java code by using code like this
Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);
if(userInfo != null){
String givenName = (String)userInfo.get("user.name.given");
String lastName =(String)userInfo.get("user.name.family");
response.getWriter().println("Hello " + givenName +" " + lastName);
}
At deployment time the portal can map the requested user profile attributes to the supported profile attributes or the portal can ignore the requested attributes.
No comments:
Post a Comment