how to identify whether to ask for the authentication or not i.e. if the user is accessing the application through internet or intranet?

hi I am creating a website which is to be deployed on intranet as well as on internet.
If the website is accessed through internet then authentication is through Facebook and in the intranet it is without any authentication.

Question is how to identify whether to ask for the authentication or not i.e. if the user is accessing the application through internet or intranet?
RockingAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jb1devConnect With a Mentor Commented:
0
 
jb1devCommented:
You mention little about your application or how it is accessed so I have to make some guesses here.

If you are using a web app / servlets, you can get the user's IP from the servlet request ServletRequest.getRemoteAddr()

see http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getRemoteAddr%28%29

And then determine if that IP address is from your intranet or not.
0
 
RockingAuthor Commented:
What if the url of both are same Or its not possible to that the url can be same?
0
 
jb1devCommented:
getRemoteAddr() returns the client IP regardless of what the URL is.
0
 
RockingAuthor Commented:
getRemoteAddr() returns the client IP regardless of what the URL is.

if it is the case then how can we identify the browser url? i need to identify the url of the browser based on which can differentiate the intranet address or internet address.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.