From 5eac425fdaa7dd5208ba261321f0919d825de46f Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Thu, 8 Aug 2024 08:57:49 +0200 Subject: [PATCH] feat(authn) : add case to test multiples CIDR --- .../layer/authn/network/authenticator_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/proxy/director/layer/authn/network/authenticator_test.go b/internal/proxy/director/layer/authn/network/authenticator_test.go index 395668a..d8e5341 100644 --- a/internal/proxy/director/layer/authn/network/authenticator_test.go +++ b/internal/proxy/director/layer/authn/network/authenticator_test.go @@ -39,6 +39,23 @@ func TestMatchAuthorizedCIDRs(t *testing.T) { }, ExpectedResult: false, }, + { + RemoteHostPort: "192.168.1.15:43349", + AuthorizedCIDRs: []string{ + "192.168.1.5/32", + "192.168.1.0/24", + }, + ExpectedResult: true, + }, + { + RemoteHostPort: "192.168.1.15:43349", + AuthorizedCIDRs: []string{ + "192.168.1.5/32", + "192.168.1.6/32", + "192.168.1.7/32", + }, + ExpectedResult: false, + }, } auth := Authenticator{}