external_auth.proto 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. syntax = "proto3";
  2. package envoy.service.auth.v3;
  3. import "envoy/config/core/v3/base.proto";
  4. import "envoy/service/auth/v3/attribute_context.proto";
  5. import "envoy/type/v3/http_status.proto";
  6. import "google/protobuf/struct.proto";
  7. import "google/rpc/status.proto";
  8. import "envoy/annotations/deprecation.proto";
  9. import "udpa/annotations/status.proto";
  10. import "udpa/annotations/versioning.proto";
  11. option java_package = "io.envoyproxy.envoy.service.auth.v3";
  12. option java_outer_classname = "ExternalAuthProto";
  13. option java_multiple_files = true;
  14. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3;authv3";
  15. option java_generic_services = true;
  16. option (udpa.annotations.file_status).package_version_status = ACTIVE;
  17. // [#protodoc-title: Authorization Service ]
  18. // The authorization service request messages used by external authorization :ref:`network filter
  19. // <config_network_filters_ext_authz>` and :ref:`HTTP filter <config_http_filters_ext_authz>`.
  20. // A generic interface for performing authorization check on incoming
  21. // requests to a networked service.
  22. service Authorization {
  23. // Performs authorization check based on the attributes associated with the
  24. // incoming request, and returns status `OK` or not `OK`.
  25. rpc Check(CheckRequest) returns (CheckResponse) {
  26. }
  27. }
  28. message CheckRequest {
  29. option (udpa.annotations.versioning).previous_message_type = "envoy.service.auth.v2.CheckRequest";
  30. // The request attributes.
  31. AttributeContext attributes = 1;
  32. }
  33. // HTTP attributes for a denied response.
  34. message DeniedHttpResponse {
  35. option (udpa.annotations.versioning).previous_message_type =
  36. "envoy.service.auth.v2.DeniedHttpResponse";
  37. // This field allows the authorization service to send an HTTP response status code to the
  38. // downstream client. If not set, Envoy sends ``403 Forbidden`` HTTP status code by default.
  39. type.v3.HttpStatus status = 1;
  40. // This field allows the authorization service to send HTTP response headers
  41. // to the downstream client. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
  42. // false when used in this message.
  43. repeated config.core.v3.HeaderValueOption headers = 2;
  44. // This field allows the authorization service to send a response body data
  45. // to the downstream client.
  46. string body = 3;
  47. }
  48. // HTTP attributes for an OK response.
  49. // [#next-free-field: 9]
  50. message OkHttpResponse {
  51. option (udpa.annotations.versioning).previous_message_type =
  52. "envoy.service.auth.v2.OkHttpResponse";
  53. // HTTP entity headers in addition to the original request headers. This allows the authorization
  54. // service to append, to add or to override headers from the original request before
  55. // dispatching it to the upstream. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
  56. // false when used in this message. By setting the `append` field to `true`,
  57. // the filter will append the correspondent header value to the matched request header.
  58. // By leaving `append` as false, the filter will either add a new header, or override an existing
  59. // one if there is a match.
  60. repeated config.core.v3.HeaderValueOption headers = 2;
  61. // HTTP entity headers to remove from the original request before dispatching
  62. // it to the upstream. This allows the authorization service to act on auth
  63. // related headers (like `Authorization`), process them, and consume them.
  64. // Under this model, the upstream will either receive the request (if it's
  65. // authorized) or not receive it (if it's not), but will not see headers
  66. // containing authorization credentials.
  67. //
  68. // Pseudo headers (such as `:authority`, `:method`, `:path` etc), as well as
  69. // the header `Host`, may not be removed as that would make the request
  70. // malformed. If mentioned in `headers_to_remove` these special headers will
  71. // be ignored.
  72. //
  73. // When using the HTTP service this must instead be set by the HTTP
  74. // authorization service as a comma separated list like so:
  75. // ``x-envoy-auth-headers-to-remove: one-auth-header, another-auth-header``.
  76. repeated string headers_to_remove = 5;
  77. // This field has been deprecated in favor of :ref:`CheckResponse.dynamic_metadata
  78. // <envoy_v3_api_field_service.auth.v3.CheckResponse.dynamic_metadata>`. Until it is removed,
  79. // setting this field overrides :ref:`CheckResponse.dynamic_metadata
  80. // <envoy_v3_api_field_service.auth.v3.CheckResponse.dynamic_metadata>`.
  81. google.protobuf.Struct dynamic_metadata = 3
  82. [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
  83. // This field allows the authorization service to send HTTP response headers
  84. // to the downstream client on success. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>`
  85. // defaults to false when used in this message.
  86. repeated config.core.v3.HeaderValueOption response_headers_to_add = 6;
  87. // This field allows the authorization service to set (and overwrite) query
  88. // string parameters on the original request before it is sent upstream.
  89. repeated config.core.v3.QueryParameter query_parameters_to_set = 7;
  90. // This field allows the authorization service to specify which query parameters
  91. // should be removed from the original request before it is sent upstream. Each
  92. // element in this list is a case-sensitive query parameter name to be removed.
  93. repeated string query_parameters_to_remove = 8;
  94. }
  95. // Intended for gRPC and Network Authorization servers `only`.
  96. message CheckResponse {
  97. option (udpa.annotations.versioning).previous_message_type =
  98. "envoy.service.auth.v2.CheckResponse";
  99. // Status `OK` allows the request. Any other status indicates the request should be denied, and
  100. // for HTTP filter, if not overridden by :ref:`denied HTTP response status <envoy_v3_api_field_service.auth.v3.DeniedHttpResponse.status>`
  101. // Envoy sends ``403 Forbidden`` HTTP status code by default.
  102. google.rpc.Status status = 1;
  103. // An message that contains HTTP response attributes. This message is
  104. // used when the authorization service needs to send custom responses to the
  105. // downstream client or, to modify/add request headers being dispatched to the upstream.
  106. oneof http_response {
  107. // Supplies http attributes for a denied response.
  108. DeniedHttpResponse denied_response = 2;
  109. // Supplies http attributes for an ok response.
  110. OkHttpResponse ok_response = 3;
  111. }
  112. // Optional response metadata that will be emitted as dynamic metadata to be consumed by the next
  113. // filter. This metadata lives in a namespace specified by the canonical name of extension filter
  114. // that requires it:
  115. //
  116. // - :ref:`envoy.filters.http.ext_authz <config_http_filters_ext_authz_dynamic_metadata>` for HTTP filter.
  117. // - :ref:`envoy.filters.network.ext_authz <config_network_filters_ext_authz_dynamic_metadata>` for network filter.
  118. google.protobuf.Struct dynamic_metadata = 4;
  119. }