0

I'm trying to develop a Java Web App to know if an user that access to the server is using a computer configured with a concrete Windows domain.

What I need to know is the name of the remote domain, as the value I get with this:

System.getenv("USERDOMAIN");

Is it possible?

Thanks.

Carlos Durán
  • 186
  • 10
  • The domain name is not the same as the OS the person is running... I don't think the domain name is sent in the user agent. – Sumurai8 Feb 11 '16 at 08:35

1 Answers1

0

You can get the User-Agent from the header of the user's HTTP request:

String userAgent = request.getHeader("User-Agent");

And there you have all the info you need: OS, browser, etc.

You can rely on these links for better understanding of the User-Agent info:

EDIT

What you could do in order to retrieve the user's domain name is:

  • retrieve the IP address from the request (use this and this answers as a starting point)
  • after having the host's IP address, you could retrieve the host's domain name like its explained here
Community
  • 1
  • 1
António Ribeiro
  • 4,129
  • 5
  • 32
  • 49