Skip to content

Commit 6ad1680

Browse files
committed
Issue 6355: update api/.../jwt_authn/.../README.md
To describe the (updated) functionality of the value_prefix field. Signed-off-by: Larry West <[email protected]>
1 parent 42cbc4a commit 6ad1680

File tree

1 file changed

+35
-0
lines changed
  • api/envoy/config/filter/http/jwt_authn/v2alpha

1 file changed

+35
-0
lines changed

api/envoy/config/filter/http/jwt_authn/v2alpha/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,38 @@ If a custom location is desired, `from_headers` or `from_params` can be used to
2929
## HTTP header to pass successfully verified JWT
3030

3131
If a JWT is valid, its payload will be passed to the backend in a new HTTP header specified in `forward_payload_header` field. Its value is base64 encoded JWT payload in JSON.
32+
33+
34+
## Further header options
35+
36+
In addition to the `name` field, which specifies the HTTP header name,
37+
the `from_headers` section can specify an optional `value_prefix` value, as in:
38+
39+
```yaml
40+
from_headers:
41+
- name: bespoke
42+
value_prefix: jwt_value
43+
```
44+
45+
The above will cause the jwt_authn filter to look for the JWT in the `bespoke` header, following the tag `jwt_value`.
46+
47+
Any non-JWT characters (i.e., anything _other than_ alphanumerics, `_`, `-`, and `.`) will be skipped,
48+
and all following, contiguous, JWT-legal chars will be taken as the JWT.
49+
50+
This means all of the following will return a JWT of `eyJFbnZveSI6ICJyb2NrcyJ9.e30.c2lnbmVk`:
51+
52+
```text
53+
bespoke: jwt_value=eyJFbnZveSI6ICJyb2NrcyJ9.e30.c2lnbmVk
54+
55+
bespoke: {"jwt_value": "eyJFbnZveSI6ICJyb2NrcyJ9.e30.c2lnbmVk"}
56+
57+
bespoke: beta:true,jwt_value:"eyJFbnZveSI6ICJyb2NrcyJ9.e30.c2lnbmVk",trace=1234
58+
```
59+
60+
The header `name` may be `Authorization`.
61+
62+
The `value_prefix` must match exactly, i.e., case-sensitively.
63+
If the `value_prefix` is not found, the header is skipped: not considered as a source for a JWT token.
64+
65+
If there are no JWT-legal characters after the `value_prefix`, the entire string after it
66+
is taken to be the JWT token. This is unlikely to succeed; the error will reported by the JWT parser.

0 commit comments

Comments
 (0)