// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.extensions.rbac.principals.mtls_authenticated.v3;

import "envoy/extensions/transport_sockets/tls/v3/common.proto";

import "udpa/annotations/status.proto";

option java_package = "io.envoyproxy.envoy.extensions.rbac.principals.mtls_authenticated.v3";
option java_outer_classname = "MtlsAuthenticatedProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/rbac/principals/mtls_authenticated/v3;mtls_authenticatedv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: RBAC MTls Authenticated Principal]
// [#extension: envoy.rbac.principals.mtls_authenticated]

// Authentication attributes for a downstream mTLS connection. All modes require that a peer certificate
// was presented and validated using the ValidationContext in the DownstreamTlsContext configuration.
//
// If neither field is set, a configuration loading error will be generated. This is so that
// not validating SANs requires an affirmative configuration to disable, to prevent accidentally
// not configuring SAN validation.
//
// If ``any_validated_client_certificate`` is set in addition to ``san_matcher`` or a future field
// which specifies additional validation, the other field always takes precedence over
// ``any_validated_client_certificate`` and all specified validation is performed.
message Config {
  // Specifies a SAN that must be present in the validated peer certificate.
  transport_sockets.tls.v3.SubjectAltNameMatcher san_matcher = 1;

  // Only require that the peer certificate is present and valid.
  bool any_validated_client_certificate = 2;
}
