• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WebServiceContext.getUserPrincipal() Question

 
Ranch Hand
Posts: 75
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I've seen a lot of talk regarding the example:


And questions regarding what is returned by the service being null. The usual response is that the web.xml file has to be configured to handle security. My question is this: I don't care about security and authentication, is there a way I can have the service identify what client made the request? Specifically, I make a request to the server via a client and have the Web service determine the userID of the client. I'm trying to get the service to display something like "userID <userIdName> made a request to service <serviceName> from <IPAddress>." No authentication is needed, just information displayed from the service.

Thanks in advance.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
The IP address can be obtained from the HttpServletRequest, I believe. This will not be available if the web service is EJB-based.
Standard Java EE security will not supply the name of a user, but only that of the principal and the client needs to present credentials in order for the principal to be set.
There is, as far as I know, no mechanism in HTTP that enclose a user id with every request.
Best wishes!
 
Emil Jennings
Ranch Hand
Posts: 75
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan, I made the changes (see below) based on your response and I'm now getting an IP address.

 
reply
    Bookmark Topic Watch Topic
  • New Topic