fixed security problem in ip authentication.

security problem  introduced in commit 53d1cf8b6f44bb690d927a33f1f358ecdffe5a52

changes:

- remove usage of 'Host' header to identify client's ip
- the request ip is used to ip authenticate direct connected clients
- add usage of trusted proxy chain
- the trusted proxy chain is used to ip authenticate indirect connected clients
- added unit and integration tests
- updated log messages
Merge branch 'security_fix_1_2'