-
Notifications
You must be signed in to change notification settings - Fork 5.5k
authz_filter: extended ext_authz to support v2alpha api #3162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 36 commits
9501403
8419745
e6d6df0
af3925b
33e7eba
0ed4639
ab5cf4c
615b64c
050f75f
7e9cf7c
09e4125
eb45964
5bd6581
559c8fb
f717cda
69ca997
568b5c1
fe9fa0c
d6e008c
dc61d76
982a210
7acf696
4b3520d
dd9d091
f1aa15f
c454122
681bc64
f8155ab
0250a49
14889bc
e17a6fc
a760b45
e2ba046
298a696
8d05a5d
b7aaef1
6058248
91db962
5c320bb
a5fcd62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.type; | ||
|
|
||
| import "validate/validate.proto"; | ||
|
|
||
| // HTTP response codes supported in Envoy. | ||
| // For more details: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml | ||
| enum StatusCode { | ||
| // Empty - This code not part of the HTTP status code specification, but it is needed for proto `enum` type. | ||
| Empty = 0; | ||
|
|
||
| Continue = 100; | ||
|
|
||
| OK = 200; | ||
| Created = 201; | ||
| Accepted = 202; | ||
| NonAuthoritativeInformation = 203; | ||
| NoContent = 204; | ||
| ResetContent = 205; | ||
| PartialContent = 206; | ||
| MultiStatus = 207; | ||
| AlreadyReported = 208; | ||
| IMUsed = 226; | ||
|
|
||
| MultipleChoices = 300; | ||
| MovedPermanently = 301; | ||
| Found = 302; | ||
| SeeOther = 303; | ||
| NotModified = 304; | ||
| UseProxy = 305; | ||
| TemporaryRedirect = 307; | ||
| PermanentRedirect = 308; | ||
|
|
||
| BadRequest = 400; | ||
| Unauthorized = 401; | ||
| PaymentRequired = 402; | ||
| Forbidden = 403; | ||
| NotFound = 404; | ||
| MethodNotAllowed = 405; | ||
| NotAcceptable = 406; | ||
| ProxyAuthenticationRequired = 407; | ||
| RequestTimeout = 408; | ||
| Conflict = 409; | ||
| Gone = 410; | ||
| LengthRequired = 411; | ||
| PreconditionFailed = 412; | ||
| PayloadTooLarge = 413; | ||
| URITooLong = 414; | ||
| UnsupportedMediaType = 415; | ||
| RangeNotSatisfiable = 416; | ||
| ExpectationFailed = 417; | ||
| MisdirectedRequest = 421; | ||
| UnprocessableEntity = 422; | ||
| Locked = 423; | ||
| FailedDependency = 424; | ||
| UpgradeRequired = 426; | ||
| PreconditionRequired = 428; | ||
| TooManyRequests = 429; | ||
| RequestHeaderFieldsTooLarge = 431; | ||
|
|
||
| InternalServerError = 500; | ||
| NotImplemented = 501; | ||
| BadGateway = 502; | ||
| ServiceUnavailable = 503; | ||
| GatewayTimeout = 504; | ||
| HTTPVersionNotSupported = 505; | ||
| VariantAlsoNegotiates = 506; | ||
| InsufficientStorage = 507; | ||
| LoopDetected = 508; | ||
| NotExtended = 510; | ||
| NetworkAuthenticationRequired = 511; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wora @mattklein123 WDYT? I like this, but do we have extensibility issues or concerns over wanting custom response codes?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wora @mattklein123 friendly ping.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have any context. Why do we need custom response codes? It's definitely not optimal.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just wondering if this status code object is sufficient for all anticipated uses across the Envoy API surface. Ack or Nack?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes seems fine. If we want custom status codes we can always add them later with comments. Can we add a validation that the enum only has the specified values, at least for now? |
||
|
|
||
| } | ||
|
|
||
| // HTTP status. | ||
| message HttpStatus { | ||
| // Supplies HTTP response code. | ||
| StatusCode code = 1 [ | ||
| (validate.rules).enum = {not_in: [0]}, | ||
| (validate.rules).enum.defined_only = true | ||
| ]; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the goal of this message? Do we anticipate other material to be part of the base status type?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to also provide a map of code int to code name string later on, e.g., WDYT? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,6 @@ Types | |
| :glob: | ||
| :maxdepth: 2 | ||
|
|
||
| ../type/http_status.proto | ||
| ../type/percent.proto | ||
| ../type/range.proto | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,11 @@ External Authorization | |
| * External authorization :ref:`architecture overview <arch_overview_ext_authz>` | ||
| * :ref:`HTTP filter v2 API reference <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>` | ||
|
|
||
| The external authorization HTTP filter calls an external gRPC service to check if the incoming | ||
| The external authorization HTTP filter calls an external gRPC or HTTP service to check if the incoming | ||
| HTTP request is authorized or not. | ||
| If the request is deemed unauthorized then the request will be denied with 403 (Forbidden) response. | ||
| If the request is deemed unauthorized then the request will be denied normally with 403 (Forbidden) response. | ||
| Note that sending additional custom metadata from the authorization service to the upstream, or to the downstream is | ||
| also possible. This is explained in more details at :ref:`HTTP filter <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>`. | ||
|
|
||
| .. tip:: | ||
| It is recommended that this filter is configured first in the filter chain so that requests are | ||
|
|
@@ -18,14 +20,14 @@ The content of the requests that are passed to an authorization service is speci | |
|
|
||
| .. _config_http_filters_ext_authz_http_configuration: | ||
|
|
||
| The HTTP filter, using a gRPC service, can be configured as follows. You can see all the | ||
| The HTTP filter, using a gRPC/HTTP service, can be configured as follows. You can see all the | ||
| configuration options at | ||
| :ref:`HTTP filter <envoy_api_msg_config.filter.http.ext_authz.v2alpha.ExtAuthz>`. | ||
|
|
||
| Example | ||
| ------- | ||
| Configuration Examples | ||
| ----------------------------- | ||
|
|
||
| A sample filter configuration could be: | ||
| A sample filter configuration for a gRPC authorization server: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
|
|
@@ -36,13 +38,39 @@ A sample filter configuration could be: | |
| envoy_grpc: | ||
| cluster_name: ext-authz | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| clusters: | ||
| - name: ext-authz | ||
| type: static | ||
| http2_protocol_options: {} | ||
| hosts: | ||
| - socket_address: { address: 127.0.0.1, port_value: 10003 } | ||
|
|
||
| A sample filter configuration for a raw HTTP authorization server: | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| http_filters: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically this is embedded somewhat in a |
||
| - name: envoy.ext_authz | ||
| config: | ||
| http_service: | ||
| server_uri: | ||
| uri: 127.0.0.1:10003 | ||
| cluster: ext-authz | ||
| timeout: 0.25s | ||
| failure_mode_allow: false | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| clusters: | ||
| - name: ext-authz | ||
| connect_timeout: 0.25s | ||
| type: logical_dns | ||
| lb_policy: round_robin | ||
| hosts: | ||
| - socket_address: { address: 127.0.0.1, port_value: 10003 } | ||
|
|
||
| Statistics | ||
| ---------- | ||
| The HTTP filter outputs statistics in the *cluster.<route target cluster>.ext_authz.* namespace. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/raw/Raw/