External Authorization

External Authorization configuration overview.

config.filter.http.ext_authz.v2.ExtAuthz

[config.filter.http.ext_authz.v2.ExtAuthz proto]

{
  "grpc_service": "{...}",
  "http_service": "{...}",
  "failure_mode_allow": "...",
  "use_alpha": "...",
  "with_request_body": "{...}",
  "clear_route_cache": "...",
  "status_on_error": "{...}",
  "metadata_context_namespaces": [],
  "filter_enabled": "{...}"
}
grpc_service

(core.GrpcService) gRPC service configuration (default timeout: 200ms).

External authorization service configuration.

Only one of grpc_service, http_service may be set.

http_service

(config.filter.http.ext_authz.v2.HttpService) HTTP service configuration (default timeout: 200ms).

External authorization service configuration.

Only one of grpc_service, http_service may be set.

failure_mode_allow

(bool) Changes filter’s behaviour on errors:

1. When set to true, the filter will accept client request even if the communication with the authorization service has failed, or if the authorization service has returned a HTTP 5xx error.

2. When set to false, ext-authz will reject client requests and return a Forbidden response if the communication with the authorization service has failed, or if the authorization service has returned a HTTP 5xx error.

Note that errors can be always tracked in the stats.

use_alpha

(bool) Sets the package version the gRPC service should use. This is particularly useful when transitioning from alpha to release versions assuming that both definitions are semantically compatible. Deprecation note: This field is deprecated and should only be used for version upgrade. See release notes for more details.

with_request_body

(config.filter.http.ext_authz.v2.BufferSettings) Enables filter to buffer the client request body and send it within the authorization request. A x-envoy-auth-partial-body: false|true metadata header will be added to the authorization request message indicating if the body data is partial.

clear_route_cache

(bool) Clears route cache in order to allow the external authorization service to correctly affect routing decisions. Filter clears all cached routes when:

  1. The field is set to true.

  2. The status returned from the authorization service is a HTTP 200 or gRPC 0.

3. At least one authorization response header is added to the client request, or is used for altering another client request header.

status_on_error

(type.HttpStatus) Sets the HTTP status that is returned to the client when there is a network error between the filter and the authorization server. The default status is HTTP 403 Forbidden.

metadata_context_namespaces

(string) Specifies a list of metadata namespaces whose values, if present, will be passed to the ext_authz service as an opaque protobuf::Struct.

For example, if the jwt_authn filter is used and payload_in_metadata is set, then the following will pass the jwt payload to the authorization server.

metadata_context_namespaces:
- envoy.filters.http.jwt_authn
filter_enabled

(core.RuntimeFractionalPercent) Specifies if the filter is enabled.

If runtime_key is specified, Envoy will lookup the runtime key to get the percentage of requests to filter.

If this field is not specified, the filter will be enabled for all requests.

config.filter.http.ext_authz.v2.BufferSettings

[config.filter.http.ext_authz.v2.BufferSettings proto]

Configuration for buffering the request data.

{
  "max_request_bytes": "...",
  "allow_partial_message": "..."
}
max_request_bytes

(uint32) Sets the maximum size of a message body that the filter will hold in memory. Envoy will return HTTP 413 and will not initiate the authorization process when buffer reaches the number set in this field. Note that this setting will have precedence over failure_mode_allow.

allow_partial_message

(bool) When this field is true, Envoy will buffer the message until max_request_bytes is reached. The authorization request will be dispatched and no 413 HTTP error will be returned by the filter.

config.filter.http.ext_authz.v2.HttpService

[config.filter.http.ext_authz.v2.HttpService proto]

HttpService is used for raw HTTP communication between the filter and the authorization service. When configured, the filter will parse the client request and use these attributes to call the authorization server. Depending on the response, the filter may reject or accept the client request. Note that in any of these events, metadata can be added, removed or overridden by the filter:

On authorization request, a list of allowed request headers may be supplied. See allowed_headers for details. Additional headers metadata may be added to the authorization request. See headers_to_add for details.

On authorization response status HTTP 200 OK, the filter will allow traffic to the upstream and additional headers metadata may be added to the original client request. See allowed_upstream_headers for details.

On other authorization response statuses, the filter will not allow traffic. Additional headers metadata as well as body may be added to the client’s response. See allowed_client_headers for details.

{
  "server_uri": "{...}",
  "path_prefix": "...",
  "authorization_request": "{...}",
  "authorization_response": "{...}"
}
server_uri

(core.HttpUri) Sets the HTTP server URI which the authorization requests must be sent to.

path_prefix

(string) Sets a prefix to the value of authorization request header Path.

authorization_request

(config.filter.http.ext_authz.v2.AuthorizationRequest) Settings used for controlling authorization request metadata.

authorization_response

(config.filter.http.ext_authz.v2.AuthorizationResponse) Settings used for controlling authorization response metadata.

config.filter.http.ext_authz.v2.AuthorizationRequest

[config.filter.http.ext_authz.v2.AuthorizationRequest proto]

{
  "allowed_headers": "{...}",
  "headers_to_add": []
}
allowed_headers

(type.matcher.ListStringMatcher) Authorization request will include the client request headers that have a correspondent match in the list. Note that in addition to the user’s supplied matchers:

  1. Host, Method, Path and Content-Length are automatically included to the list.

2. Content-Length will be set to 0 and the request to the authorization service will not have a message body.

headers_to_add

(core.HeaderValue) Sets a list of headers that will be included to the request to authorization service. Note that client request of the same key will be overridden.

config.filter.http.ext_authz.v2.AuthorizationResponse

[config.filter.http.ext_authz.v2.AuthorizationResponse proto]

{
  "allowed_upstream_headers": "{...}",
  "allowed_client_headers": "{...}"
}
allowed_upstream_headers

(type.matcher.ListStringMatcher) When this list is set, authorization response headers that have a correspondent match will be added to the original client request. Note that coexistent headers will be overridden.

allowed_client_headers

(type.matcher.ListStringMatcher) When this list. is set, authorization response headers that have a correspondent match will be added to the client’s response. Note that when this list is not set, all the authorization response headers, except Authority (Host) will be in the response to the client. When a header is included in this list, Path, Status, Content-Length, WWWAuthenticate and Location are automatically added.

config.filter.http.ext_authz.v2.ExtAuthzPerRoute

[config.filter.http.ext_authz.v2.ExtAuthzPerRoute proto]

Extra settings on a per virtualhost/route/weighted-cluster level.

{
  "disabled": "...",
  "check_settings": "{...}"
}
disabled

(bool) Disable the ext auth filter for this particular vhost or route. If disabled is specified in multiple per-filter-configs, the most specific one will be used.

Precisely one of disabled, check_settings must be set.

check_settings

(config.filter.http.ext_authz.v2.CheckSettings) Check request settings for this route.

Precisely one of disabled, check_settings must be set.

config.filter.http.ext_authz.v2.CheckSettings

[config.filter.http.ext_authz.v2.CheckSettings proto]

Extra settings for the check request. You can use this to provide extra context for the external authorization server on specific virtual hosts routes. For example, adding a context extension on the virtual host level can give the ext-authz server information on what virtual host is used without needing to parse the host header. If CheckSettings is specified in multiple per-filter-configs, they will be merged in order, and the result will be used.

{
  "context_extensions": "{...}"
}
context_extensions

(map<string, string>) Context extensions to set on the CheckRequest’s AttributeContext.context_extensions

Merge semantics for this field are such that keys from more specific configs override.

Note

These settings are only applied to a filter configured with a grpc_service.