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
2) Configure and activate the plugin as a middleware in your dynamic traefik config:
@@ -85,7 +85,7 @@ Name | Description
85
85
`skipPrefetch` | Don't prefetch keys from `issuers`. This is useful if all the expected secrets are provided in `secrets`, especially in situations where traefik or its services are frequently restarted, to save from hitting the issuer JWKS endpoint unnecessarily.
86
86
`delayPrefetch` | Delay prefetching keys from `issuers` by the given duration (expressed in `time.ParseDuration` format - e.g. "300ms", "5s"). This is particularly useful if your openid server is behind the very traefik service that is loading the plugin and you need to give it time to be ready for your request. This has no effect if `skipPrefetch` is set.
87
87
`refreshKeysInterval` | Arbitrarily refresh all keys from all `issuers` in a background thread every given duration (after any prefetch).
88
-
`require` | A map of zero or more claims that must all be present and match against one or more values. If no claims are specified in `require`, all tokens that are validly signed by the trusted issuers or secrets will pass. If more than one claim is specified, each is required (i.e. an AND relationship exists for all the specified claims). For each claim, multiple values may be specified and the claim will be valid if any matches (i.e. an OR relationship exists for required values within a claim). fnmatch-style wildcards are optionally supported for claims in issued JWTs. If you do not wish to support wildcard claims, simply do not put such wildcards into the JWTs that you issue. See below for examples and the variables available with template interpolation.
88
+
`require` | A map of zero or more claims that must all be present and match against one or more values. If no claims are specified in `require`, all tokens that are validly signed by the trusted issuers or secrets will pass. If more than one claim is specified, each is required (i.e. an AND relationship exists for all the specified claims). For each claim, multiple values may be specified and the claim will be valid if any matches (i.e. a default OR relationship exists for required values within a claim). It is possible to specify alternate logic using `$and` and `$or` operators (see Claim Matching examples below). fnmatch-style wildcards are optionally supported for claims in issued JWTs. If you do not wish to support wildcard claims, simply do not put such wildcards into the JWTs that you issue. See below for examples and the variables available with template interpolation.
89
89
`headerMap` | A map in the form of header -> claim. Headers will be added (or overwritten) to the forwarded HTTP request from the claim values in the token. If the claim is not present, no action for that value is taken (and any existing header will remain unchanged).
90
90
`removeMissingHeaders` | When set to `true`, remove any headers provided in the request that are named in the `headerMap` but are not present in the token as claims. This may be an important security consideration for some uses of headers if your JWT provider cannot be relied upon to provide an expected claim in all situations. Default: `false`.
91
91
`cookieName` | Name of the cookie to retrieve the token from if present. Default: `Authorization`. If token retrieval from cookies must be disabled for some reason, set to an empty string. If `forwardAuth` is `false`, the cookie will be removed before forwarding to the backend.
@@ -162,6 +162,7 @@ require:
162
162
"iss": "auth.example.com",
163
163
"aud": "*.example.com"
164
164
}
165
+
165
166
```
166
167
Note that the wildcard claim is granted to the _user_ in their JWT, not asked for in the requirements. I.e. you are granting a key that can open multiple locks rather than creating a lock that accepts multiple keys. If you don't want to support these optional wildcards, simply do not issue such JWTs.
167
168
@@ -182,6 +183,43 @@ require:
182
183
}
183
184
```
184
185
186
+
#### And logic
187
+
```yaml
188
+
require:
189
+
role:
190
+
$and: ["hr", "power"] # both are required
191
+
```
192
+
Note that, similar to MongoDB, the `$and` and `$or` operators are a single-value object with operator as the key and the choices as an array value
193
+
194
+
```json
195
+
{
196
+
"role": ["hr", "power"],
197
+
}
198
+
```
199
+
200
+
201
+
#### Complex nested logic
202
+
```yaml
203
+
require:
204
+
role:
205
+
$or:
206
+
- $and: ["hr", "power"] # both are required
207
+
- "admin" # this alone will pass
208
+
```
209
+
Note that mixing yaml array styles here is arbitrary and both are used to enhance clarity of the structure
210
+
211
+
```json
212
+
{
213
+
"role": ["hr", "power"],
214
+
}
215
+
```
216
+
217
+
```json
218
+
{
219
+
"role": ["admin"],
220
+
}
221
+
```
222
+
185
223
### Examples
186
224
187
225
#### Interactive webserver with redirection to login and error pages
// getKey gets the key for the given key ID from the plugin's key cache.
509
346
// If the key isn't present and the iss is valid according to the plugin's configuration, all keys for the iss are refreshed and the key is looked up again.
// createClients reads a list of domains in the InsecureSkipVerify configuration and creates a map of domains to http.Client with InsecureSkipVerify set.
0 commit comments