Skip to Content
author's profile photo
Former Member

How to get current user for WS

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Feb 17, 2005 at 04:08 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • Posted on Feb 18, 2005 at 08:03 PM

    Hi Aliaksandr,

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

    HTH,

    Vladimir

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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