How do I find the WAN IP address of a Smart Client?

Questions, answers, tips and ideas on Servoy Client

How do I find the WAN IP address of a Smart Client?

Postby swingman » Mon Oct 17, 2011 12:44 pm

Hi all,

I need to restrict access to some functionality depending on whether a use is working from the Office (where the Servoy server is located) or from home.
Code: Select all
application.getIPAddress()

Seems to give me the IP on the local network. I need to work out whether someone has connected remotely..

Any ideas?

C
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: How do I find the WAN IP address of a Smart Client?

Postby patrick » Mon Oct 17, 2011 12:48 pm

Maybe call something like http://whatismyipaddress.com/ using the http client?
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How do I find the WAN IP address of a Smart Client?

Postby patrick » Mon Oct 17, 2011 12:52 pm

Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How do I find the WAN IP address of a Smart Client?

Postby swingman » Mon Oct 17, 2011 1:02 pm

Thanks Patrick, one of these will work fine!
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: How do I find the WAN IP address of a Smart Client?

Postby ptalbot » Mon Oct 17, 2011 1:51 pm

Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: How do I find the WAN IP address of a Smart Client?

Postby jcompagner » Tue Oct 18, 2011 2:42 pm

application.getServerUrl() ??
or do your really need the ip instead of the dns name that a users sees?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: How do I find the WAN IP address of a Smart Client?

Postby swingman » Tue Oct 18, 2011 3:03 pm

Hi Jan,

I need to work out whether someone is working in the office or from home.

The scenario is: Company has valuable data, when someone quits their job and are allowed to work their notice period, they may no longer be allowed to work from home.
In the case of such a blocked user: if the IP is the same as the external IP for the server, I assume office, otherwise I refuse to load Servoy. I know there may be ways around this such as ssh tunnels or vnc'ing into office, but the users are not technical people and don't have access to the right passwords.

I have already implemented a solution using Patrick's suggestion
Code: Select all
http://automation.whatismyip.com/n09230945.asp


Grabbing this URL using the http plugin works fine. I can lock myself out using a tick box on my user screen in Servoy and ssh into the Postgres database to grant myself access again.

Are you thinking of adding something like application.server_is_local() to Servoy?
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: How do I find the WAN IP address of a Smart Client?

Postby jcompagner » Tue Oct 18, 2011 3:14 pm

server is local??
when is the server local?? if you are really on the same network?
thats a bit weird, the server can also be outside of the companies network, hosted in some big hosting centra
what is then local?

If the server is really local you could do it with getServerUrl() already, because remote users must then go to a public url and internal users are just using the internal url.

But yes if the server is hosted somewhere else you have the situation that you have 3 locations and then the serverurl will not work because they are most likely the same for internal and external people
then WAN IP is the only way to go.

But maybe.. if security is important you can better include WAN ip's at the server location...
So access to the servoy http/rmi ports are only by opt in. People want to use it from how have give there wan ip's so that they are whitelisted...
But this is annoying again if you don't have a (almost) fixed ip address... But it is way more secure..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Client

Who is online

Users browsing this forum: No registered users and 7 guests