# Limit login of a specific users from whitelist IP address

**URL:** <https://forum.keycloak.org/t/limit-login-of-a-specific-users-from-whitelist-ip-address/11089>\
**Category:** Getting advice\
**Tags:** authentication\
**Created:** [September 21, 2021, 4:38am UTC](https://forum.keycloak.org/t/limit-login-of-a-specific-users-from-whitelist-ip-address/11089 "2021-09-21T04:38:42Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [September 22, 2021, 6:21pm UTC](https://forum.keycloak.org/t/limit-login-of-a-specific-users-from-whitelist-ip-address/11089/6 "2021-09-22T18:21:51Z")

</div>

If you are trying to do that in a custom Authenticator you can use the `AuthenticationFlowContext`. Depending if you’re using a reverse proxy the IP can come from one of the following methods:

```auto
    // no reverse proxy
    authenticationFlowContext.getHttpRequest().getRemoteAddress();

    // with reverse proxy
    authenticationFlowContext.getHttpRequest().getHttpHeaders().getHeaderString("X-Forwarded-For");

```

---

_[View the full topic](https://forum.keycloak.org/t/limit-login-of-a-specific-users-from-whitelist-ip-address/11089)._
