Hi All!
A little OPPORTUNITY here. I have created a portlet application, which pushes data into MSSQL table via standart WSDL. Also I have managed bean in which i would like to store username and id of logined user in order to insert them in the table. How can I get current logined user to proceed him in my portle data operations?
If you just want the username, you can use the standard technique for getting the remote username
For example:
getFacesContext().getExternalContext().getRemoteUser()
Or if you need more details about the current user, you can use the MWS CDS apis.
For example:
IDirectorySession s = null;
try {
//start a directory session
s = DirectorySystemFactory.getDirectorySystem().createSession();
//lookup the info about the current user
IDirectoryPrincipal principal = s.lookupPrincipalByID(IDirectorySession.CURRENT_USER);
String name = principal.getName();
//etc..
} finally {
//done, so release the directory session
if (s != null) {
DirectorySystemFactory.getDirectorySystem().destroySession(s);
}
}