Skip to content

Commit

Permalink
Updated ip-address-whitelist*.js to ip-address-allowlist*.js (#295)
Browse files Browse the repository at this point in the history
* Update and rename ip-address-whitelist.js to ip-address-allowlist.js

* Update and rename ip-address-whitelist.test.js to ip-address-allowlist.test.js
  • Loading branch information
Zack authored Jul 20, 2021
1 parent b4d3945 commit b1e55a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @title IP Address whitelist
* @title IP Address allowlist
* @overview Only allow access to an app from a specific set of IP addresses.
* @gallery true
* @category access control
Expand All @@ -8,9 +8,9 @@
*
*/

function ipAddressWhitelist(user, context, callback) {
const whitelist = ['1.2.3.4', '2.3.4.5']; // authorized IPs
const userHasAccess = whitelist.some(function (ip) {
function ipAddressAllowlist(user, context, callback) {
const allowlist = ['1.2.3.4', '2.3.4.5']; // authorized IPs
const userHasAccess = allowlist.some(function (ip) {
return context.request.ip === ip;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const loadRule = require('../utils/load-rule');
const ContextBuilder = require('../utils/contextBuilder');
const RequestBuilder = require('../utils/requestBuilder');

const ruleName = 'ip-address-whitelist';
const ruleName = 'ip-address-allowlist';

describe(ruleName, () => {
let context;
Expand All @@ -22,7 +22,7 @@ describe(ruleName, () => {
.build();
});

it('if ip isn`t in the whitelist', (done) => {
it('if ip isn`t in the allowlist', (done) => {
rule({}, context, (err) => {
expect(err).toBeInstanceOf(Error);
expect(err.message).toEqual('Access denied from this IP address.');
Expand All @@ -40,7 +40,7 @@ describe(ruleName, () => {
.build();
});

it('if ip isn`t in the whitelist', (done) => {
it('if ip isn`t in the allowlist', (done) => {
rule({}, context, (err, u, c) => {
expect(c.request.ip).toEqual('1.2.3.4');
done();
Expand Down

0 comments on commit b1e55a7

Please sign in to comment.