ADF show Display Name of logged in user.

This post will show you how to show the display name of a user currently logged in rather than the username.

The java is as follows:
public String getUser() throws IdentityStoreException, JpsException,                                   IMException {        ADFContext adfCtx = ADFContext.getCurrent();        SecurityContext secCntx = adfCtx.getSecurityContext();        UserProfile up = secCntx.getUserProfile();        String user = up.getDisplayName();        return user;    }
This will return null unless the following is populated in the weblogic server, as the display name is not deployed along with the jazn-data.xml file.

In the weblogic console: 

1) Go to Security Realms
2) Select myrealm
3) Select Users and Groups tab
4) Select requested user
5) Select Attributes Tab 
6) Finally set the displayname attribute to desired value.


Popular Posts