From 0fc5ef52ff116258e6eb4dcc82cabe2f0459d0b1 Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Mon, 9 Dec 2024 15:59:59 +0100 Subject: [PATCH] docs: add access policy middleware --- README.md | 3 +++ docs/index.md | 3 +++ docs/middleware/access-policy.md | 32 ++++++++++++++++++++++++++++++++ docs/middleware/basic.md | 2 +- docs/middleware/jwt.md | 2 +- docs/middleware/oauth.md | 2 +- docs/middleware/rate-limit.md | 6 +++--- 7 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 docs/middleware/access-policy.md diff --git a/README.md b/README.md index 53991ee..69f40c3 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,9 @@ It's designed to be straightforward and efficient, offering a rich set of featur - **Authentication Middleware** - Support for **JWT** with client authorization based on request results. - **Basic-Auth** and **OAuth** authentication mechanisms. +- **Access Policy Middleware** + + The Access Policy middleware controls route access by either `allowing` or `denying` requests based on defined rules. ### Monitoring and Performance - **Logging** diff --git a/docs/index.md b/docs/index.md index 8776ea7..3c65194 100644 --- a/docs/index.md +++ b/docs/index.md @@ -48,6 +48,9 @@ It's designed to be straightforward and efficient, offering a rich set of featur - **Authentication Middleware** - Support for **JWT** with client authorization based on request results. - **Basic-Auth** and **OAuth** authentication mechanisms. +- **Access Policy Middleware** + + The Access Policy middleware controls route access by either `allowing` or `denying` requests based on defined rules. ### Monitoring and Performance - **Logging** diff --git a/docs/middleware/access-policy.md b/docs/middleware/access-policy.md new file mode 100644 index 0000000..e7d255b --- /dev/null +++ b/docs/middleware/access-policy.md @@ -0,0 +1,32 @@ +--- +title: Access Policy +layout: default +parent: Middleware +nav_order: 3 +--- + + +### Access Policy Middleware +The Access Policy middleware controls route access by either allowing or denying requests based on defined rules. +It supports two actions: `ALLOW` and `DENY`. + +### How It Works +1. **Define an action:** Specify whether the middleware should `ALLOW` or `DENY` access. + +2. **Set sourceRanges:** Provide a list of IP addresses or IP ranges to which the policy applies. + + Requests originating from these sources will be evaluated according to the specified action. + +#### Example Configuration +Here’s an example of an Access Policy middleware configuration in YAML: + +```yaml +middlewares: + - name: access-policy + type: accessPolicy + rule: + action: DENY # Specify either DENY or ALLOW + sourceRanges: + - 192.168.1.1 # Single IP address + - 172.18.0.0-172.18.0.10 # IP range +``` diff --git a/docs/middleware/basic.md b/docs/middleware/basic.md index 41c758c..e96dedd 100644 --- a/docs/middleware/basic.md +++ b/docs/middleware/basic.md @@ -2,7 +2,7 @@ title: Basic auth layout: default parent: Middleware -nav_order: 3 +nav_order: 4 --- diff --git a/docs/middleware/jwt.md b/docs/middleware/jwt.md index 7628510..6e25479 100644 --- a/docs/middleware/jwt.md +++ b/docs/middleware/jwt.md @@ -2,7 +2,7 @@ title: JWT Middleware layout: default parent: Middleware -nav_order: 4 +nav_order: 5 --- diff --git a/docs/middleware/oauth.md b/docs/middleware/oauth.md index 13e4068..32f3e34 100644 --- a/docs/middleware/oauth.md +++ b/docs/middleware/oauth.md @@ -2,7 +2,7 @@ title: OAuth auth layout: default parent: Middleware -nav_order: 5 +nav_order: 6 --- # OAuth middleware diff --git a/docs/middleware/rate-limit.md b/docs/middleware/rate-limit.md index 35eec6a..f78c43a 100644 --- a/docs/middleware/rate-limit.md +++ b/docs/middleware/rate-limit.md @@ -1,8 +1,8 @@ --- -title: Rate Limit +title: Rate Limiting layout: default parent: Middleware -nav_order: 6 +nav_order: 7 --- @@ -15,7 +15,7 @@ Example of rate limiting middleware ```yaml middlewares: - name: rate-limit - type: ratelimit #or rateLimit + type: rateLimit #or ratelimit paths: - /* rule: