Skip to content

Commit 327de21

Browse files
API v4.2.2 (#43)
* njs bugfix * 20240226-01 Commit * 20240226-02 Commit * 20240226-03 Commit * 20240226-04 Commit * 20240226-05 Commit * 20240229-01 Commit Added client JWT-based authorization * 20240229-02 Commit * 20240206-01 Commit * 20240206-02 Commit * 20240206-03 Commit * 20240206-03 Commit
1 parent ff0d32f commit 327de21

File tree

15 files changed

+411
-22
lines changed

15 files changed

+411
-22
lines changed

FEATURES.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Client-side authentication profiles to be defined under `.declaration.http.authe
5353
"jwt": {
5454
"realm": "<JWT_AUTHENTICATION_REALM>",
5555
"key": "<JWT_KEY>|<JWT_KEY_URL>",
56-
"cachetime": <JWT_KEY_CACHETIME_IN_SECONDS>,
56+
"cachetime": <OPTIONAL_JWT_KEY_CACHETIME_IN_SECONDS>,
5757
"token_location": "<OPTIONAL_TOKEN_LOCATION_AS_NGINX_VARIABLE>"
5858
}
5959
}
@@ -72,6 +72,36 @@ Client-side authentication profiles to be defined under `.declaration.http.authe
7272
}
7373
```
7474

75+
### Client authorization
76+
77+
| Type | Description | API v4.0 | API v4.1 | API v4.2 | Notes |
78+
|------|----------------------|----------|----------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
79+
| jwt | Java Web Token (JWT) | | | X | Based on JWT claims. Supported under <li>.declaration.http.server[]</li><li>.declaration.http.server[].location[]</li><li>.declaration.http.server[].location[].apigateway</li> |
80+
81+
#### Examples
82+
83+
Client-side authorization profiles to be defined under `.declaration.http.authorization`
84+
85+
- jwt client authorization profile
86+
87+
```json
88+
{
89+
"name": "<PROFILE_NAME>",
90+
"type": "jwt",
91+
"jwt": {
92+
"claims": [
93+
{
94+
"name": "<CLAIM_NAME>",
95+
"value": [
96+
"<AUTHORIZED_VALUE_OR_REGEXP>"
97+
],
98+
"errorcode": <OPTIONAL_ERROR_CODE_401_OR_403>
99+
}
100+
]
101+
}
102+
}
103+
```
104+
75105
### Upstream and Source of truth authentication
76106

77107
| Type | Description | API v4.0 | API v4.1 | API v4.2 | Notes |

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Use cases include:
2020
- `http` snippets, upstreams, servers, locations
2121
- `stream` snippets, upstreams, servers
2222
- Swagger / OpenAPI schemas
23+
- NGINX Javascript files
2324

2425
## Requirements
2526

USAGE-v4.2.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,14 @@ Declaration path `.declaration.http.servers[].locations[].apigateway` defines th
115115
- `api_gateway.server_url` - the base URL of the upstream server
116116
- `developer_portal.enabled` - enable/disable Developer portal provisioning
117117
- `developer_portal.uri` - the trailing part of the Developer portal URI, this is appended to `.declaration.http.servers[].locations[].uri`. If omitted it defaults to `devportal.html`
118-
- `authentication` - optional, used to enforce JWT authentication at the API Gateway level
119-
- `authentication.client` - JWT authentication profile name
120-
- `authentication.enforceOnPaths` - if set to `true` JWT authentication is enforced on all API endpoints listed under `authentication.paths`. if set to `false` JWT authentication is enforced on all API endpoints but those listed under `authentication.paths`
118+
- `authentication` - optional, used to enforce authentication at the API Gateway level
119+
- `authentication.client[]` - authentication profile names
120+
- `authentication.enforceOnPaths` - if set to `true` authentication is enforced on all API endpoints listed under `authentication.paths`. if set to `false` authentication is enforced on all API endpoints but those listed under `authentication.paths`
121+
- `authentication.paths` - paths to enforce authentication
122+
- `authorization[]` - optional, used to enforce authorization
123+
- `authorization[].profile` - authorization profile name
124+
- `authorization[].enforceOnPaths` - if set to `true` authorizaion is enforced on all API endpoints listed under `authorization.paths`. if set to `false` authorization is enforced on all API endpoints but those listed under `authorization[].paths`
125+
- `authorization[].paths` - paths to enforce authorization
121126
- `rate_limit` - optional, used to enforce rate limiting at the API Gateway level
122127
- `rate_limit.enforceOnPaths` - if set to `true` rate limiting is enforced on all API endpoints listed under `rate_limit.paths`. if set to `false` rate limiting is enforced on all API endpoints but those listed under `rate_limit.paths`
123128

@@ -192,6 +197,16 @@ is:
192197
"/user/logout"
193198
]
194199
},
200+
"authorization": [
201+
{
202+
"profile": "JWT role based authorization",
203+
"enforceOnPaths": true,
204+
"paths": [
205+
"/user/login",
206+
"/user/logout"
207+
]
208+
}
209+
],
195210
"rate_limit": [
196211
{
197212
"profile": "petstore_ratelimit",
@@ -245,7 +260,23 @@ is:
245260
}
246261
}
247262
]
248-
}
263+
},
264+
"authorization": [
265+
{
266+
"name": "JWT role based authorization",
267+
"type": "jwt",
268+
"jwt": {
269+
"claims": [
270+
{
271+
"name": "roles",
272+
"value": [
273+
"~(devops)"
274+
]
275+
}
276+
]
277+
}
278+
}
279+
]
249280
}
250281
}
251282
}

0 commit comments

Comments
 (0)