cancel
Showing results for 
Search instead for 
Did you mean: 

Always getting j2ee_guest as logged in user

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Have you tried to use the following instead of the posted code:

WDClientUser.getLoggedInClientUser();

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

I am getting j2ee_guest with the method WDClientUser.getLoggedInClientUser();

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi,

Is your application authenticated? Have you turned the <b>"sap.authentication"</b> property of the application as <b>true</b>?

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

Can you please tell where to check this.

Regards

Nikhil

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

One more query. If I don't give sap.authentication as true then why j2ee_guest is returned as the logged in user.

Regards

Nikhil Bansal

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Satyajit,

Your solution seems to be correct.

My application is a stand-alone application.

I was able to remove the inital Logon screen in Portal by providing user mapping for the System. However, this is not an ideal scenario. Is there a way around.

Regards

Nikhil Bansal

Former Member
0 Kudos

Hi,

If you are running a WD application within the portal, then this is the only way. Why do you think it is not an ideal scenario?

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satya,

This is not an ideal scenario as for every user, User Mapping has to be provided. In my portal there may be > 1000 users. Can I replace this User Mapping with SSO with SAPLogonTicket.

Regards

Nikhil Bansal

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Bharathwaj,

Difficult to believe that the thread was confusing. There were a few concepts of which I was unclear. Hence, I had to post questions.

Anyway, thanks for your inputs.

My query is solved. I am closing the thread.

Regards

Nikhil

Former Member
0 Kudos

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.

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hello Nikil,

your code is right. Check if your SAP users and Portal user are correctly mapped.

Regards

former_member720137
Active Participant
0 Kudos

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

Former Member
0 Kudos

Hi Puneet,

Thanks for the inputs.

I am deploying the application as j2ee_admin on the server.

Even after creating a iview for it in the portal I always get j2ee_guest as the user.

It is difficult to understand why this is happening.

Regards

Nikhil