Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Httpservlet ecurity methods

 
vitesse wei
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is different between getUserPrincipal() and getRemoteUser(),only different is what they returned?I see the JavaDoc,it's said
a String specifying the login of the user making this request, or null if the user login is not known

what is "the login" mean,what String value we will have if user is fail/pass on authentication?
thanks.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you mean HttpServletRequest.

"the login" means the user name.

If authentication fails? If authentication fails, the user doesn't get in. If the user doesn't get in, there's no code to run that would ask for the user name.

If, however, the user is in an area that doesn't require authentication, there can be code that looks for the user name. It won't find anything though. Both methods will return null, just as the API says.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!