i have a problem to get the current username from an user wich is logged on, on the MWS and hope to find here an solution.
Issue/Description:
On MWS we used an LDAP Dircetory Service for authentification. If an User is logged on and use an application, I would like to get the current user name as an input for a service on IS for further work.
I try to use the “getUser” Service form PSUtilities, but even when a User is logged on I will get the username “Administrator”.
yes, I solved this issue, but I used an other way.
At runtime off the portlet apllication I use a java principalmodel object to get the date from the current user and redirect this data with the initialize action to the input fields of an IS webservice for further work.
The reason you’re getting Administrator is because you’re calling the web service using simple authentication (type 1), with Administrator/password for the credentials.
To get the user’s credentials you need to be calling using hybrid authentication (type 3), which passes through the logged on MWS user’s credentials. Then just your web service permissions need to be set up to handle that, but at least you aren’t keeping your IS Administrator credentials in every portlet you deploy!
I’m having the same problem, i’ve changed authentication mode to hybrid(type 3) and using the java code to get user but it’s returning for me “Default”
//Get the current session
Session currentSession = Service.getSession();
//Get current user
User user = currentSession.getUser();
//Assign the username value to strUsername
String strUsername = user.getName();
//insert the username into the pipeline
IDataCursor idcPipeline = pipeline.getCursor();
idcPipeline.insertAfter("username", strUsername);