How to restrict login to a website inside an office only in Java? I want to restrict the access of a site only when they are in office but provide some people can access at any where
-
That's called as Firewall. Nothing to do with Java for that. – Suresh Atta Aug 04 '14 at 10:13
-
Restrict users using their ip-addresses: http://stackoverflow.com/questions/10363069/how-can-i-retrieve-ip-address-from-http-header-in-java/10363109#10363109 – Aug 04 '14 at 10:16
-
can i identify with mac id?? – user3906140 Aug 04 '14 at 10:17
-
but user can change ip address. so what to do? – user3906140 Aug 04 '14 at 10:18
-
Why don't you build a login system? – Pieter VDE Aug 04 '14 at 10:19
-
Yep, you can get user IP, then try to lookup for his MAC-address, look here how to do it: http://stackoverflow.com/questions/6164167/get-mac-address-on-local-machine-with-java – Alex Chernyshev Aug 04 '14 at 10:19
1 Answers
A MAC-address will only be visible to a server that's on the same local area network (and subnet) as the client, thus you will never be able to see the true MAC-address of a user who's at home, or otherwise outside the 'range' of the subnet your server is on... It's kind of hard to explain to someone who do not have extensive network understanding - and I assume you don't.
You have a couple of choices:
1) Restrict the website to your office only, and allow VPN-clients access to your network and thus also your website + provide your clients with VPN-capabilities.
2) Setup a proxy that only allows ip-addresses from your local area network and disallows the others
3) Design and implement a security-scheme in your website that compares the IP-address of the client to a 'whitelist' of some sort, and then allow/disallow the user.
- 815
- 7
- 18
-
-
-
I'm not sure I understand what you're asking. The subnet mask is something that sets the range of a subset of IP-adresses. This if you have an IP-address of 10.1.1.9, it will match 10.1.1.0/255.255.255.240, but it won't match 10.1.1.0/255.255.255.248. If you don't understand subnets and netmasks, then forget this whole ordeal. Of the 3 possible scenarios I posted as a way to go, which one would suit you best? – OddBeck Aug 04 '14 at 12:30