JWT
Requires incoming requests include a JSON Web Token (JWT). The signature of the token is verified and grants are validated.
Example
-
YAML
-
JSON
authentication:
name: jwt
key: env.JWT_KEY
algorithms:
- HS256
{
"authentication": {
"name": "jwt",
"key": "env.JWT_KEY",
"algorithms": [
"HS256"
]
}
}
Configuration
| Claim | Implementation |
|---|---|
|
Ensure the JWT hasn’t expired and it’s no further than a certain amount of time from now |
|
Validate it matches a specific value |
|
Validate it matches a specific value |
|
Validate it matches a specific value |
|
Validate it contains a specific scope OR ensure a given prefix plus the layer in the current request is contained in scope |
|
Validate the current tile being requested is partially contained in the geohash. See the crop provider to limit raster imagery layers to precise areas |
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
|
The key for verifying the signature. The public key if using asymmetric signing. If the value starts with |
string |
No |
None |
|
Algorithms to allow for JWT signatures. One or more of: |
string[] |
Yes |
None |
|
Fetch verification keys from a remote JWKS endpoint instead of Key. See JWKS |
JWKS |
No |
None |
|
The header to extract the JWT from. If this is |
string |
No |
Authorization |
|
How many seconds from now can the expiration be. JWTs more than X seconds from now will result in a 401 |
uint32 |
No |
1 day |
|
Require the |
string |
No |
None |
|
Require the |
string |
No |
None |
|
Require the |
string |
No |
None |
|
Require the |
string |
No |
None |
|
If true the |
bool |
No |
false |
|
If true this prefix indicates scopes to use. For example a prefix of |
string |
No |
Empty string |
|
Use the specified claim as the user identifier. By default this primarily allows identifying who made a request in logs/analytics, however custom providers can use this for more bespoke use cases. |
string |
No |
sub |
|
Use the specified claim as the tenant identifier. This is optional and generally only makes sense if you also use User ID. Useful if you have users grouped into some form of account system. It’s possible to set this to the same claim as UserID. |
string |
No |
tid |
JWKS
Instead of a single static Key, verification keys can be fetched from a remote JWKS endpoint as commonly published by an OIDC issuer. When JWKS is configured, Key must not be set.
If a token references a key ID that isn’t in the currently cached keyset then the keyset is refreshed, rate limited by RefreshMinInterval. This allows an issuer to rotate its keys without any action from the Operator. If the issuer becomes unreachable the last successfully fetched keyset continues to be used, so existing keys still verify and only tokens signed with a new key ID fail while the endpoint is down.
-
YAML
-
JSON
authentication:
name: jwt
algorithms:
- RS256
jwks:
url: https://issuer.example.com/.well-known/jwks.json
expectedIssuer: https://issuer.example.com/
expectedAudience: tilegroxy
{
"authentication": {
"name": "jwt",
"algorithms": [
"RS256"
],
"jwks": {
"url": "https://issuer.example.com/.well-known/jwks.json"
},
"expectedIssuer": "https://issuer.example.com/",
"expectedAudience": "tilegroxy"
}
}
| Parameter | Description | Type | Required | Default |
|---|---|---|---|---|
|
The HTTPS URL of the JWKS endpoint. Plain http is rejected |
string |
Yes |
None |
|
How many seconds between unconditional refreshes of the keyset |
uint |
No |
900 |
|
The minimum seconds between refreshes triggered by an unknown key ID |
uint |
No |
60 |
|
How many seconds before a fetch of the keyset is cancelled |
uint |
No |
10 |
|
If false, a failed fetch of the keyset at startup prevents the server from starting. If true, it logs a warning instead and the server starts anyway |
bool |
No |
false |