cancel
Showing results for 
Search instead for 
Did you mean: 

How to get current user for WS

Former Member
0 Kudos

Hello

I've created Web Service from Stateless Session Bean with Basic Authentification & Support Logon Ticket features.

I need to determine current logged user in bean methods.

UMFactory.getAuthenticator().getLoggedInUser() method requires Request & Response.

WDClientUser.getCurrentUser() throws NullPointerException when i try call it.

Accepted Solutions (0)

Answers (2)

Answers (2)

Vlado
Advisor
Advisor
0 Kudos

Hi Aliaksandr,

What about javax.ejb.SessionContext.getCallerPrincipal()? Is it suitable for you?

HTH,

Vladimir

Former Member
0 Kudos

Hi Vladimir

Unfortunatelly no, I need to check user.isAuthenticated() later, when I perform search user by given Principal using UserFactory.getUserByLogonId() it returns "abstract" user account.

Aliaksandr

Former Member
0 Kudos

Hi Aliaksandr,

try this,

WDClientUser.forceLoggedInClientUser().getSAPUser().

getUniqueName();

In order to the User ID, you have to run your WD application in the Portal.

Hope it helps,

- Teecheu

Former Member
0 Kudos

Same exception: WDClientUser is null for bean.

I call WS from WAS Web Services Navigator -> WS Home -> Test -> method...

Former Member
0 Kudos

Hi, try to use the following, it works for me:

WDClientUser.getCurrentUser();

Best Regards.

Victor.

Former Member
0 Kudos

Hi Victor.

Do you use it into EJB or into WD application?

I have Web service created for EJB and I call EJB methods remotelly with basic authentification.

Aliaksandr.

Former Member
0 Kudos

Hi,

I am using it in a Web Dynpro component and I think that it is the only plase you can use it. If you want to determine the user in a EJB I think that javax.ejb.SessionContext.getCallerPrincipal() should work as already was mentioned.

Best Regards.

Victor