You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,21 @@ It validates a JWT token passed in the `Authorization` header against a configur
7
7
The configuration format currently only supports a single elliptic curve public key for signature validation, and does not have a facility for rotating keys without restart. Basic support in the configuration format for supporting multiple active keys, and of different types, at once is in place but currently not used.
8
8
9
9
# Configuration
10
-
The service takes a configuration file in YAML format. For example:
10
+
A number of flags affect how the service is started:
11
+
12
+
Flag | Description | Default
13
+
---------|-------------|--------------------
14
+
--help | Show help | -
15
+
--config | Path to configuration file | config.yaml
16
+
--log-level| Log level | info
17
+
--tls-key | Path to TLS key | `<required>`
18
+
--tls-cert | Path to TLS cert | `<required>`
19
+
--addr | Address/port to serve traffic in TLS mode | :8443
20
+
--insecure | Serve traffic unencrypted over http | false
21
+
--insecure-addr | Address/port to serve traffic in insecure mode | :8080
22
+
23
+
## Configuration file
24
+
The service takes a configuration file in YAML format, by default `config.yaml`. For example:
11
25
12
26
```yaml
13
27
validationKeys:
@@ -27,7 +41,7 @@ With this configuration, a JWT will be validated against the given public key, a
27
41
28
42
Claims can either be statically set, as in the above example, or passed via query string parameters. The `claimsSource` configuration parameter controls which mode the server operates in, and can be either `static` or `queryString`. Further examples of the two modes are given below.
29
43
30
-
## Static
44
+
### Static
31
45
32
46
Multiple alternative allowed sets of claims can be configured, for example:
33
47
@@ -68,7 +82,7 @@ claims:
68
82
69
83
Here, the token claims must **both** have the groups as before, **and** a `location` of `hq`.
70
84
71
-
## Query string
85
+
### Query string
72
86
In query string mode, the allowed claims are passed via query string parameters to the /validate endpoint. For example, with `/validate?claims_group=developers&claims_group=administrators&claims_location=hq`, the token claims must **both** have a `group` claim of **either** `developers` or `administrators`, **and** a `location` claim of `hq`.
73
87
74
88
Each claim must be prefixed with `claims_`. Giving the same claim multiple time results in any value being accepted.
@@ -81,13 +95,13 @@ If no claims are passed in this mode, the request will be denied.
81
95
To use with the NGINX Ingress Controller, first create a deployment and a service for this endpoint. See the [kubernetes/](kubernetes/) directory for example manifests. Then on the ingress object you wish to authenticate, add this annotation for a server in static claims source mode:
Change the url to match the name of the service and namespace you chose when deploying. All requests will now have their JWTs validated before getting passed to the upstream service.
0 commit comments