Quantcast
Channel: SCN : Discussion List - SAP Enterprise Portal : Administration and Development
Viewing all articles
Browse latest Browse all 2686

Getting logged in user in a RESTful Service

$
0
0

Hello,

 

i am trying to get the current logged in user in my REST Service.

I have tried many different solutions but nothing works.

 

My resource class which returns always Guest:

 

public class ReportConfigResource extends HttpServlet  {

     

    @Context private HttpServletRequest req;

    @Context private HttpServletResponse res;

 

 

     public ReportConfigResource(){

 

      }

 

    @Path("/getUserName")

    @GET

    @Consumes(javax.ws.rs.core.MediaType.APPLICATION_JSON)

    @Produces(javax.ws.rs.core.MediaType.APPLICATION_JSON)

    public String getUserName(){

        IUser user = UMFactory.getAuthenticator().getLoggedInUser();

        return user.getDisplayName().toString();

    }

 

}

 

same code changed to:

 

IUser user = UMFactory.getAuthenticator().getLoggedInUser(req, res);

 

gives me a null object.

 

Any ideas?

 

Thanks.


Viewing all articles
Browse latest Browse all 2686

Trending Articles