on 06-05-2007 9:28 AM
Hi All,
I am creating an application where I am supposed to get the user id which has logged into the portal. My code is as follows
IWDClientUser clientUser = WDClientUser.getCurrentUser();
IUser user = clientUser.getSAPUser();
eMailId = user.getEmail();
I am always getting the user as j2ee_guest no matter whoever has logged into the system. I am suprised why this is happening.
Plz help.
Regards
Nikhil Bansal
Hi,
Have you tried to use the following instead of the posted code:
WDClientUser.getLoggedInClientUser();
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Within the NWDS, right-click on your application name and choose "Edit". Select the "Application Properties" tab and check the table. If it is empty or if it doesn't contain <b>sap.authentication</b>, then click on New->Pre defined->Browse->Authentication. Then select "true" from the dropdown as the value.
Regards,
Satyajit.
Hi Satyajit,
I did set the sap.authentication as true for the Application. It is returning the correct user id. However, whenever the application is called the user is asked to login first. After the user logs in then the Outlook Inbox is shown.
Is there a way to remove this step of authenticating the user again i.e. user should not be asked to login again.
Regards
Nikhil
Hi,
Are you running the application as a stand-alone application? If yes then it is normal that you will be asked to log in first. This should be solved if you run the application inside a portal. The portal logged in user will be the authenticated user.
But if this is occurring even within the portal, then you need to check the user mapping for the web dynpro systems.
Regarding your second question, if you don't provide explicit authentication to the application it is authenticated as the default anonymous user "j2ee_guest". As a result when you try to retrieve the current logged in user, you get "j2ee_guest".
Regards,
Satyajit.
Message was edited by:
Satyajit Chakraborty
Hi ,
The whole thread seems to be rather confusing .
The point is , if the application is authenticated .. then when you access.. getLoggedInClientUser.. you would get the logged in user . Otherwise , you would get j2ee_guest.
1. portal and web as system are same ..
There is no usermapping / logon ticket necessary. Just creating the iview (iview should not be anonymous).. and setting.. sap.authentication to true in webdynpro application properties.. should suffice.
2. If the portal is different from the app server where WD app is deployed..
Then , you need to use usermapping or logonticket... both would give the same result. and logontickets are advised for higher no of users.Then ensure sap.authentication = true.. and iview as not anonymous...
Once this is done.. it should work.. otherwise... the code is definitely rigged.
Regards
Bharathwaj
Hi,
To get logged in user details, I have used below code in EP 7.01 version
IUser user = UMFactory.getAuthenticator().getLoggedInUser();
String strUserId = "";
strUserId = user.getName();
and I was able to retrieve logged in user's userID and printed the userID in log file.
But in 7.3 version, same code is giving me userID as "J2EE_GUEST" and not my userID. We have tried this with many userID logins but getting userId as "J2EE_GUEST".
Can someone please tell me why I am getting userID as "J2EE_GUEST" and how to get the logged in UserID.
Hi Nikhil,
Your is correct. After deploying the application, login to the portal and check the iView, you will get the correct user. I hope this will work.
Cheers,
SivaPrasath.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nikil,
your code is right. Check if your SAP users and Portal user are correctly mapped.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
U know y u r getting j2ee_guest.. coz u r deploying ur application on J2ee server as j2ee_guest user...
Ur Code is right.. all u need to do is login into the portal.. n then c the preview of the application.. u will get the username who has logged in..
Or login into the portal in a window n then deploy ur application..
Hope it will help u...
Regards
Puneet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.