Project: Gloo (Orchestration & Management / API Gateway)
File: config.proto.sk.md

title: "config.proto" weight: 5 <!-- Code generated by solo-kit. DO NOT EDIT. --> Please see following for JWT authentication flow: `JSON Web Token (JWT) <https://tools.ietf.org/html/rfc7519>`_ `The OAuth 2.0 Authorization Framework <https://tools.ietf.org/html/rfc6749>`_ `OpenID Connect <http://openid.net/connect>`_ A JwtProvider message specifies how a JSON Web Token (JWT) can be verified. It specifies: issuer: the principal that issues the JWT. If specified, it has to match the iss* field in JWT. allowed audiences: the ones in the token have to be listed here. how to fetch public key JWKS to verify the token signature. how to extract JWT token in the request. how to pass successfully verified token payload. Example: .. code-block:: yaml issuer: https://example.com audiences: bookstore_android.apps.googleusercontent.com bookstore_web.apps.googleusercontent.com remote_jwks: http_uri: uri: https://example.com/.well-known/jwks.json cluster: examplejwkscluster timeout: 1s cache_duration: seconds: 300 [#next-free-field: 11] ```yaml "issuer": string "audiences": []string "remoteJwks": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.RemoteJwks "localJwks": .solo.io.envoy.config.core.v3.DataSource "forward": bool "fromHeaders": []solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtHeader "fromParams": []string "forwardPayloadHeader": string "payloadInMetadata": string "clockSkewSeconds": int ``` | Field | Type | Description | | -- | - | -- | | `issuer` | `string` | Specify the `principal <https://tools.ietf.org/html/rfc7519#section-4.1.1>` that issued the JWT, usually a URL or an email address. It is optional. If specified, it has to match the *iss* field in JWT. If a JWT has *iss* field and this field is specified, they have to match, otherwise the JWT *iss* field is not checked. Note: *JwtRequirement* :ref:`allowmissing <envoyv3apifieldextensions.filters.http.jwtauthn.v3.JwtRequirement.allowmissing>` and :ref:`allowmissingorfailed <envoyv3apifieldextensions.filters.http.jwtauthn.v3.JwtRequirement.allowmissingorfailed>` are implemented differently than other *JwtRequirements*. Hence the usage of this field is different as follows if *allowmissing or allowmissingor_failed is used: If a JWT has iss field, it needs to be specified by this field in one of JwtProviders. If a JWT doesn't have iss field, one of JwtProviders should fill this field empty. Multiple JwtProviders should not have same value in this field. Example: https://securetoken.google.com Example: 1234567-compute@developer.gserviceaccount.com. | | `audiences` | `[]string` | The list of JWT `audiences <https://tools.ietf.org/html/rfc7519#section-4.1.3>` are allowed to access. A JWT containing any of these audiences will be accepted. If not specified, will not check audiences in the token. Example: .. code-block:: yaml audiences: - bookstoreandroid.apps.googleusercontent.com - bookstore_web.apps.googleusercontent.com. | | `remoteJwks` | | JWKS can be fetched from remote server via HTTP/HTTPS. This field specifies the remote HTTP URI and how the fetched JWKS should be cached. Example: .. code-block:: yaml remotejwks: httpuri: uri: https://www.googleapis.com/oauth2/v1/certs cluster: jwt.www.googleapis.com|443 timeout: 1s cache_duration: seconds: 300. Only one of `remoteJwks` or `localJwks` can be set. | | `localJwks` | | JWKS is in local data source. It could be either in a local file or embedded in the inlinestring. Example: local file .. code-block:: yaml localjwks: filename: /etc/envoy/jwks/jwks1.txt Example: inlinestring .. code-block:: yaml localjwks: inline_string: ACADADADADA. Only one of `localJwks` or `remoteJwks` can be set. | | `forward` | `bool` | If false, the JWT is removed in the request after a success verification. If true, the JWT is not removed in the request. Default value is false. | | `fromHeaders` | | Two fields below define where to extract the JWT from an HTTP request. If no explicit location is specified, the following default locations are tried in order: 1. The Authorization header using the `Bearer schema <https://tools.ietf.org/html/rfc6750#section-2.1>`. Example:: Authorization: Bearer <token>. 2. `accesstoken <https://tools.ietf.org/html/rfc6750#section-2.3>` query parameter. Multiple JWTs can be verified for a request. Each JWT has to be extracted from the locations its provider specified or from the default locations. Specify the HTTP headers to extract JWT token. For examples, following config: .. code-block:: yaml fromheaders: - name: x-goog-iap-jwt-assertion can be used to extract token from header:: ``x-goog-iap-jwt-assertion: <JWT>``. | | `fromParams` | `[]string` | JWT is sent in a query

`jwtparams` represents the query parameter names. For example, if config is: .. code-block:: yaml fromparams: - jwttoken The JWT format in query parameter is:: /path?jwttoken=<JWT>. | | `forwardPayloadHeader` | `string` | This field specifies the header name to forward a successfully verified JWT payload to the backend. The forwarded data is:: base64urlencoded(jwtpayloadinJSON) If it is not specified, the payload will not be forwarded. | | `payloadInMetadata` | `string` | If non empty, successfully verified JWT payloads will be written to StreamInfo DynamicMetadata in the format as: namespace is the jwtauthn filter name as **envoy.filters.http.jwtauthn The value is the protobuf::Struct. The value of this field will be the key for its fields and the value is the protobuf::Struct converted from JWT JSON payload. For example, if payloadinmetadata is my_payload: .. code-block:: yaml envoy.filters.http.jwtauthn: mypayload: iss: https://example.com sub: test@example.com aud: https://example.com exp: 1501281058. | | `clockSkewSeconds` | `int` | Specify the clock skew in seconds when verifying JWT time constraint, such as `exp`, and `nbf`. If not specified, default is 60 seconds. | This message specifies how to fetch JWKS from remote and how to cache it. ```yaml "httpUri": .solo.io.envoy.config.core.v3.HttpUri "cacheDuration": .google.protobuf.Duration "asyncFetch": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwksAsyncFetch ``` | Field | Type | Description | | -- | - | -- | | `httpUri` | | The HTTP URI to fetch the JWKS. For example: .. code-block:: yaml http_uri: uri: https://www.googleapis.com/oauth2/v1/certs cluster: jwt.www.googleapis.com|443 timeout: 1s. | | `cacheDuration` | | Duration after which the cached JWKS should be expired. If not specified, default cache duration is 5 minutes. | | `asyncFetch` | | Fetch Jwks asynchronously in the main thread before the listener is activated. Fetched Jwks can be used by all worker threads. If this feature is not enabled: The Jwks is fetched on-demand when the requests come. During the fetching, first few requests are paused until the Jwks is fetched. Each worker thread fetches its own Jwks since Jwks cache is per worker thread. If this feature is enabled: Fetched Jwks is done in the main thread before the listener is activated. Its fetched Jwks can be used by all worker threads. Each worker thread doesn't need to fetch its own. Jwks is ready when the requests come, not need to wait for the Jwks fetching. | Fetch Jwks asynchronously in the main thread when the filter config is parsed. The listener is activated only after the Jwks is fetched. When the Jwks is expired in the cache, it is fetched again in the main thread. The fetched Jwks from the main thread can be used by all worker threads. ```yaml "fastListener": bool ``` | Field | Type | Description | | -- | - | -- | | `fastListener` | `bool` | If false, the listener is activated after the initial fetch is completed. The initial fetch result can be either successful or failed. If true, it is activated without waiting for the initial fetch to complete. Default is false. | This message specifies a header location to extract JWT token. ```yaml "name": string "valuePrefix": string ``` | Field | Type | Description | | -- | - | -- | | `name` | `string` | The HTTP header name. | | `valuePrefix` | `string` | The value prefix. The value format is "valueprefix<token>" For example, for "Authorization: Bearer <token>", valueprefix="Bearer " with a space at the end. | Specify a required provider with audiences. ```yaml "providerName": string "audiences": []string ``` | Field | Type | Description | | -- | - | -- | | `providerName` | `string` | Specify a required provider

| | `audiences` | `[]string` | This field overrides the one specified in the JwtProvider. | This message specifies a Jwt requirement. An empty message means JWT verification is not required. Here are some config examples: .. code-block:: yaml provider_name: provider-A requires_any: requirements: provider_name: provider-A provider_name: provider-B requires_all: requirements: provider_name: provider-A provider_name: provider-B requires_all: requirements: provider_name: provider-A requires_any: requirements: provider_name: provider-B provider_name: provider-C requires_any: requirements: provider_name: provider-A requires_all: requirements: provider_name: provider-B provider_name: provider-C missing token.) requires_any: requirements: provider_name: provider-A allow_missing: {} requires_all: requirements: requires_any: requirements: provider_name: provider-A allow_missing: {} provider_name: provider-B [#next-free-field: 7] ```yaml "providerName": string "providerAndAudiences": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.ProviderWithAudiences "requiresAny": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirementOrList "requiresAll": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirementAndList "allowMissingOrFailed": .google.protobuf.Empty "allowMissing": .google.protobuf.Empty ``` | Field | Type | Description | | -- | - | -- | | `providerName` | `string` | Specify a required provider name. Only one of `providerName`, `providerAndAudiences`, `requiresAny`, `requiresAll`, `allowMissingOrFailed`, or `allowMissing` can be set. | | `providerAndAudiences` | | Specify a required provider with audiences. Only one of `providerAndAudiences`, `providerName`, `requiresAny`, `requiresAll`, `allowMissingOrFailed`, or `allowMissing` can be set. | | `requiresAny` | | Specify list of JwtRequirement. Their results are OR-ed. If any one of them passes, the result is passed. Only one of `requiresAny`, `providerName`, `providerAndAudiences`, `requiresAll`, `allowMissingOrFailed`, or `allowMissing` can be set. | | `requiresAll` | | Specify list of JwtRequirement. Their results are AND-ed. All of them must pass, if one of them fails or missing, it fails. Only one of `requiresAll`, `providerName`, `providerAndAudiences`, `requiresAny`, `allowMissingOrFailed`, or `allowMissing` can be set. | | `allowMissingOrFailed` | | The requirement is always satisfied even if JWT is missing or the JWT verification fails. A typical usage is: this filter is used to only verify JWTs and pass the verified JWT payloads to another filter, the other filter will make decision. In this mode, all JWT tokens will be verified. Only one of `allowMissingOrFailed`, `providerName`, `providerAndAudiences`, `requiresAny`, `requiresAll`, or `allowMissing` can be set. | | `allowMissing` | | The requirement is satisfied if JWT is missing, but failed if JWT is presented but invalid. Similar to allowmissingor_failed, this is used to only verify JWTs and pass the verified payload to another filter. The different is this mode will reject requests with invalid tokens. Only one of `allowMissing`, `providerName`, `providerAndAudiences`, `requiresAny`, `requiresAll`, or `allowMissingOrFailed` can be set. | This message specifies a list of RequiredProvider. Their results are OR-ed; if any one of them passes, the result is passed ```yaml "requirements": []solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement ``` | Field | Type | Description | | -- | - | -- | | `requirements` | | Specify a list of JwtRequirement. | This message specifies a list of RequiredProvider. Their results are AND-ed; all of them must pass, if one of them fails or missing, it fails. ```yaml "requirements": []solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement ``` | Field | Type | Description | | -- | - | -- | | `requirements` | | Specify a list of JwtRequirement. | This message specifies a Jwt requirement for a specific Route condition. Example 1: .. code-block:: yaml match: prefix: /healthz In above example, "requires" field is empty for /healthz prefix match, it means that requests matching the path prefix don't require JWT authentication. Example 2: .. code-block:: yaml match: prefix: / requires: { provider_name: provider-A } In above example, all requests matched the path prefix require jwt authentication from "provider-A". ```yaml "match": .solo.io.envoy.config.route.v3.RouteMatch "requires": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement "requirementName": string ``` | Field | Type | Description | | -- | - | -- | | `match` | | The route matching parameter. Only when the match is satisfied, the "requires" field will

For example: following match will match all requests. .. code-block:: yaml match: prefix: /. | | `requires` | | Specify a Jwt requirement. Please see detail comment in message JwtRequirement. Only one of `requires` or `requirementName` can be set. | | `requirementName` | `string` | Use requirementname to specify a Jwt requirement. This requirementname MUST be specified at the :ref:`requirementmap <envoyv3apifieldextensions.filters.http.jwtauthn.v3.JwtAuthentication.requirement_map>` in `JwtAuthentication`. Only one of `requirementName` or `requires` can be set. | This message specifies Jwt requirements based on stream_info.filterState. This FilterState should use `Router::StringAccessor` object to set a string value. Other HTTP filters can use it to specify Jwt requirements dynamically. Example: .. code-block:: yaml name: jwt_selector requires: issuer_1: provider_name: issuer1 issuer_2: provider_name: issuer2 If a filter set "jwtselector" with "issuer1" to FilterState for a request, jwtauthn filter will use JwtRequirement{"providername": "issuer1"} to verify. ```yaml "name": string "requires": map<string, .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement> ``` | Field | Type | Description | | -- | - | -- | | `name` | `string` | The filter state name to retrieve the `Router::StringAccessor` object. | | `requires` | `map<string, .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement>` | A map of string keys to requirements. The string key is the string value in the FilterState with the name specified in the name field above. | This is the Envoy HTTP filter config for JWT authentication. For example: .. code-block:: yaml providers: provider1: issuer: issuer1 audiences: audience1 audience2 remote_jwks: http_uri: uri: https://example.com/.well-known/jwks.json cluster: examplejwkscluster timeout: 1s provider2: issuer: issuer2 local_jwks: inlinestring: jwksstring rules: match: prefix: /health match: prefix: /prefix requires: provider_name: provider1 match: prefix: / requires: requires_any: requirements: provider_name: provider1 provider_name: provider2 [#next-free-field: 6] ```yaml "providers": map<string, .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtProvider> "rules": []solo.io.envoy.extensions.filters.http.jwt_authn.v3.RequirementRule "filterStateRules": .solo.io.envoy.extensions.filters.http.jwt_authn.v3.FilterStateRule "bypassCorsPreflight": bool "requirementMap": map<string, .solo.io.envoy.extensions.filters.http.jwt_authn.v3.JwtRequirement> ``` | Field | Type | Description | | -- | - | -- | | `providers` | `map<string, .solo.io.envoy.extensions.filters.http.jwtauthn.v3.JwtProvider>` | Map of provider names to JwtProviders. .. code-block:: yaml providers: provider1: issuer: issuer1 audiences: - audience1 - audience2 remotejwks: httpuri: uri: https://example.com/.well-known/jwks.json cluster: examplejwkscluster timeout: 1s provider2: issuer: provider2 localjwks: inlinestring: jwksstring. | | `rules` | | Specifies requirements based on the route matches. The first matched requirement will be applied. If there are overlapped match conditions, please put the most specific match first. Examples .. code-block:: yaml rules: - match: prefix: /healthz - match: prefix: /baz requires: providername: provider1 - match: prefix: /foo requires: requiresany: requirements: - providername: provider1 - providername: provider2 - match: prefix: /bar requires: requiresall: requirements: - providername: provider1 - provider_name: provider2. | | `filterStateRules` | | This message specifies Jwt requirements based on stream_info.filterState. Other HTTP filters can use it to specify Jwt requirements dynamically. The rules field above is checked first, if it could not find any matches, check this one. | | `bypassCorsPreflight` | `bool` | When set to true, bypass the `CORS preflight request <http://www.w3.org/TR/cors/#cross-origin-request-with-preflight>`_ regardless of JWT requirements specified in the rules. | | `requirementMap` | `map<string, .solo.io.envoy.extensions.filters.http.jwtauthn.v3.JwtRequirement>` | A map of unique requirementnames to JwtRequirements. :ref:`requirementname <envoyv3apifieldextensions.filters.http.jwtauthn.v3.PerRouteConfig.requirement_name>` in `PerRouteConfig` uses this map to specify a JwtRequirement. | Specify per-route config. ```yaml "disabled": bool "requirementName": string ``` | Field | Type | Description | | -- | - | -- | | `disabled` | `bool` | Disable Jwt Authentication for this route. Only one of `disabled` or `requirementName` can be set. | | `requirementName` | `string` | Use requirementname to specify a JwtRequirement. This requirementname MUST be specified at the :ref:`requirementmap <envoyv3apifieldextensions.filters.http.jwtauthn.v3.JwtAuthentication.requirement_map>` in `JwtAuthentication`. If no, the requests using this route will be rejected with 403. Only one of `requirementName` or `disabled` can be set. | <!-- Start of HubSpot Embed Code --> <script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/5130874.js"></script> <!-- End of HubSpot Embed