Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do u find out the client username?

 
Dean Fredericks
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive set up security in my web.xml, and server.xml

I see the method req.isUserInRole(),

But what I really want is the calling clients username.

How do I get this??

Thanks
Dean
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"request.getRemoteUser()" is that what you want?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try req.getUserPrincipal().getName().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic