external_auth.proto 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. syntax = "proto3";
  2. package envoy.service.auth.v2;
  3. import "envoy/api/v2/core/base.proto";
  4. import "envoy/service/auth/v2/attribute_context.proto";
  5. import "envoy/type/http_status.proto";
  6. import "google/rpc/status.proto";
  7. import "udpa/annotations/status.proto";
  8. import "validate/validate.proto";
  9. option java_package = "io.envoyproxy.envoy.service.auth.v2";
  10. option java_outer_classname = "ExternalAuthProto";
  11. option java_multiple_files = true;
  12. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/auth/v2;authv2";
  13. option java_generic_services = true;
  14. option (udpa.annotations.file_status).package_version_status = FROZEN;
  15. // [#protodoc-title: Authorization Service ]
  16. // The authorization service request messages used by external authorization :ref:`network filter
  17. // <config_network_filters_ext_authz>` and :ref:`HTTP filter <config_http_filters_ext_authz>`.
  18. // A generic interface for performing authorization check on incoming
  19. // requests to a networked service.
  20. service Authorization {
  21. // Performs authorization check based on the attributes associated with the
  22. // incoming request, and returns status `OK` or not `OK`.
  23. rpc Check(CheckRequest) returns (CheckResponse) {
  24. }
  25. }
  26. message CheckRequest {
  27. // The request attributes.
  28. AttributeContext attributes = 1;
  29. }
  30. // HTTP attributes for a denied response.
  31. message DeniedHttpResponse {
  32. // This field allows the authorization service to send a HTTP response status
  33. // code to the downstream client other than 403 (Forbidden).
  34. type.HttpStatus status = 1 [(validate.rules).message = {required: true}];
  35. // This field allows the authorization service to send HTTP response headers
  36. // to the downstream client. Note that the `append` field in `HeaderValueOption` defaults to
  37. // false when used in this message.
  38. repeated api.v2.core.HeaderValueOption headers = 2;
  39. // This field allows the authorization service to send a response body data
  40. // to the downstream client.
  41. string body = 3;
  42. }
  43. // HTTP attributes for an ok response.
  44. message OkHttpResponse {
  45. // HTTP entity headers in addition to the original request headers. This allows the authorization
  46. // service to append, to add or to override headers from the original request before
  47. // dispatching it to the upstream. Note that the `append` field in `HeaderValueOption` defaults to
  48. // false when used in this message. By setting the `append` field to `true`,
  49. // the filter will append the correspondent header value to the matched request header.
  50. // By leaving `append` as false, the filter will either add a new header, or override an existing
  51. // one if there is a match.
  52. repeated api.v2.core.HeaderValueOption headers = 2;
  53. }
  54. // Intended for gRPC and Network Authorization servers `only`.
  55. message CheckResponse {
  56. // Status `OK` allows the request. Any other status indicates the request should be denied.
  57. google.rpc.Status status = 1;
  58. // An message that contains HTTP response attributes. This message is
  59. // used when the authorization service needs to send custom responses to the
  60. // downstream client or, to modify/add request headers being dispatched to the upstream.
  61. oneof http_response {
  62. // Supplies http attributes for a denied response.
  63. DeniedHttpResponse denied_response = 2;
  64. // Supplies http attributes for an ok response.
  65. OkHttpResponse ok_response = 3;
  66. }
  67. }