Skip to content

Commit cb51511

Browse files
authored
Keep token_header in the proxied request (#4)
1 parent 548d225 commit cb51511

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

README.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ Plugin is protecting Kong API service/route with introspection of Oauth2.0 JWT a
99

1010
## Configuration
1111

12-
| Form Parameter | default | description |
13-
| --- | --- | --- |
14-
| `config.introspection_endpoint` | | **Required**. External introspection endpoint compatible with RFC7662 |
15-
| `config.client_id` | | **Required**. Client ID |
16-
| `config.client_secret` | | **Required**. Client secret |
17-
| `config.token_header` | Authorization | Name of api-request header containing access token |
18-
| `config.token_query` | token | Name of query parameter containing access token, only if `token_header` value was missing |
19-
| `config.require_success` | true | Require a successful introspection before proxying the request, if false `token_header` existance will not be required |
20-
| `config.token_cache_time` | 0 | Cache TTL for every token introspection result(0 - no cache) |
21-
| `config.introspection_map` | | External introspection response `body` and `headers` mapped to request headers, also `static` for fixed strings |
12+
| Form Parameter | default | description |
13+
| ------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
14+
| `config.introspection_endpoint` | | **Required**. External introspection endpoint compatible with RFC7662 |
15+
| `config.client_id` | | **Required**. Client ID |
16+
| `config.client_secret` | | **Required**. Client secret |
17+
| `config.token_header` | Authorization | Name of api-request header containing access token |
18+
| `config.keep_token_header` | false | Keep the token_header in the proxied request |
19+
| `config.token_query` | token | Name of query parameter containing access token, only if `token_header` value was missing |
20+
| `config.require_success` | true | Require a successful introspection before proxying the request, if false `token_header` existance will not be required |
21+
| `config.token_cache_time` | 0 | Cache TTL for every token introspection result(0 - no cache) |
22+
| `config.introspection_map` | | External introspection response `body` and `headers` mapped to request headers, also `static` for fixed strings |
2223

2324
## How to install
2425

2526
**1.1.0** `luarocks install https://raw.githubusercontent.com/medwing/kong-token-introspection/v1.1.0/access-token-introspection-1.1.0-0.rockspec`
2627

2728
**1.1.1** `luarocks install https://raw.githubusercontent.com/medwing/kong-token-introspection/v1.1.1/access-token-introspection-1.1.1-0.rockspec`
29+
30+
**1.2.0** `luarocks install https://raw.githubusercontent.com/medwing/kong-token-introspection/v1.2.0/access-token-introspection-1.2.0-0.rockspec`

access-token-introspection-1.1.1-0.rockspec access-token-introspection-1.2.0-0.rockspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package = "access-token-introspection"
2-
version = "1.1.1-0"
2+
version = "1.2.0-0"
33

44
source = {
55
url = "git://github.com/medwing/kong-token-introspection",
6-
tag = "v1.1.1"
6+
tag = "v1.2.0"
77
}
88

99
description = {

kong/plugins/access-token-introspection/access.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ function _M.run(conf)
9797
end
9898

9999
-- clear token header from req
100-
ngx.req.clear_header(_M.conf.token_header)
100+
if not _M.conf.keep_token_header then
101+
ngx.req.clear_header(_M.conf.token_header)
102+
end
101103
end
102104

103105
return _M

kong/plugins/access-token-introspection/schema.lua

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ return {
5454
default = "Authorization"
5555
}
5656
},
57+
{
58+
keep_token_header = {
59+
type = "boolean",
60+
required = false,
61+
default = false
62+
}
63+
},
5764
{
5865
token_query = {
5966
type = "string",

0 commit comments

Comments
 (0)