White-Listing IPs in WSO2 API Manager

DZone 's Guide to

White-Listing IPs in WSO2 API Manager

Learn how to create an advanced throttling policy for white-listing IPs using the WSO2 API Manager's throttling and policy enforcement engine.

· Integration Zone ·
Free Resource

This article is only applicable to the WSO2 API Manager 2.x.x family.

Usually, IP white-listing is a way of configuring a filter to exempt a particular set of known IP address, grant access to given assets, and keep them from being rejected or filtered. Simply, it is a registry that has the “known” IPs.

WSO2 introduced a powerful mechanism to create a throttling and policy enforcement engine backed by Siddhi CEP. This has become very handy and easy to develop.

Please follow the below steps to create an advanced throttling policy to white-list, and attach it to the API.

Step 1: Log in to the Admin Portal using the URL https://<Hostname>:<Port>/admin and your admin credentials.

Step 2: Click "Advanced Throttling" under the Throttle Policies section. The existing set of throttling tiers is displayed. To add a new tier, click Add Tier.

Step 3: Fill in the details required by this form and click Add Conditional Group to add a conditional group.

Step 4 : Click on conditional group to add conditional group details

Step 5 : Fill the condition group details. In that case, you need to enable IP condition and specify the IP that you need to white-list. Once the invert condition is enabled and set the throttling limit to be 0 then none of the requests coming from IPs other than the white-listing IP will be served by the gateway. After filling the details, click save.

Now the policy is created successfully and you need to engage this policy with a particular API. For that,

Step 6 : Login to API Publisher https://localhost:9443/publisher
In the ‘Manage’ tab of API create/update window, enable advanced throttling for API and select the throttling policy that we have created before, from the drop down and Save the API.

Now the API will be accessible only by the IP specified in the throttling policy.

Note: Since it takes some time to deploy the policy, the first few requests from the IPs other than the white-listed IP/IPs will be passed through. After the policy is successfully deployed, non-white-listed IP access will be blocked.

api, api management, cep, integration, throttling, wso2, wso2 api manager

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}