cancel
Showing results for 
Search instead for 
Did you mean: 

Differences to get current user

Former Member
0 Kudos

Hello

I have a problem to get the current logged in user in a webdynpro java. The WebDynPro is in 7.3. The invoke of the 7.3 WebDynPro is from a 7.0 NW Portal.

Actually I use the following snipped to get the current user:

String currentUser = WDClientUser.getCurrentUser().getSAPUser().getUniqueID();

Normally, this works correct. But sometimes I have the problem that I get as the current user the guest user. In this case I see the follwing error in the log:

The received security session id related cookie is not valid. The current request will be isolated in a new session. There might be a few reasons causing this behavior: 1) Possible session fixation hacker's attack. 2) The received security session id cookie is already outdated. One possible solution is increasing the value of the 'SecuritySessionIdGracePeriod' servlet_jsp property. For more information read SAP Note 1464914. 3) No security session id cookie is sent (over http) because it is protected via custom configuration of the http service properties 'SecuritySessionIDHTTPSProtection' and 'SystemCookiesHTTPSProtection'. Revise the configuration of the http service properties or adapt the problematic scenario accordingly.

Now I tried the following snippets:

String currentUser = WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueID()

String currentUser = WDClientUser.forceLoggedInClientUser().getSAPUser().getUniqueID()

Both of them returns the correct user in the problem case. But now my question. What exactly is the difference between getCurrentUser() and getLoggedInClientUser()? I need to know the possible side-effects by this change.

Thank you for your answer.

Accepted Solutions (1)

Accepted Solutions (1)

Sharathmg
Active Contributor
0 Kudos

Hello Simon,

Your question, made me think about this. On referring the api, the following textual explanation for the method was retrieved.

1. getLoggedInClientUser:

Returns the currently logged in client user. This is either an authenticated user or an anonymous user. The anonymous user can be a named one or an unnamed one, depending on the configuration of the UME.

2. getCurrentUser:

Gets the IWDClientUser object of the currently running session. This can be either an authenticated or anonymous client user.

Technically speaking, I always use getLoggedInUser as it gives the user who has logged into the portal. getCurrentUser seems more focused on the session of the application/portal.

Regards,

Sharath

Former Member
0 Kudos

Hello Sharath

Thank you for your answer. I found the explanations about these methods some days ago. But they are usually not really helpful.

I use now the forceLoggedInClientUser methods. But then I have another problem with demo users (which have no nt-account)..

SAP seems to have a session problem between a sap portal 7.0 and a portal 7.3.

Regards

Simon

Sharathmg
Active Contributor
0 Kudos

Agreed.

With WD Java, some aspects are not as open as Java. A fact that we have to live with while working on SAP.

Regards,

Sharath

Answers (0)