This package defines user-facing authentication policy.
Policy defines what authentication methods can be accepted on workload(s),
and if authenticated, which method/certificate will set the request principal
(i.e request.auth.principal attribute).
Authentication policy is composed of 2-part authentication:
- peer: verify caller service credentials. This part will set source.user
(peer identity).
- origin: verify the origin credentials. This part will set request.auth.user
(origin identity), as well as other attributes like request.auth.presenter,
request.auth.audiences and raw claims. Note that the identity could be
end-user, service account, device etc.
Last but not least, the principal binding rule defines which identity (peer
or origin) should be used as principal. By default, it uses peer.
Examples:
Policy to enable mTLS for all services in namespace frod. The policy name must be
default
, and it contains no rule for targets
.
Policy to disable mTLS for “productpage” service
Policy to require mTLS for peer authentication, and JWT for origin authentication
for productpage:9000 except the path ‘/health_check’ . Principal is set from origin identity.
Field | Type | Description | Required |
---|
peers | PeerAuthenticationMethod[] | List of authentication methods that can be used for peer authentication.
They will be evaluated in order; the first validate one will be used to
set peer identity (source.user) and other peer attributes. If none of
these methods pass, request will be rejected with authentication failed error (401).
Leave the list empty if peer authentication is not required | No |
targets | TargetSelector[] | Deprecated. Only mesh-level and namespace-level policies are supported.
List rules to select workloads that the policy should be applied on.
If empty, policy will be used on all workloads in the same namespace. | No |
peerIsOptional | bool | Deprecated. Should set mTLS to PERMISSIVE instead.
Set this flag to true to accept request (for peer authentication perspective),
even when none of the peer authentication methods defined above satisfied.
Typically, this is used to delay the rejection decision to next layer (e.g
authorization).
This flag is ignored if no authentication defined for peer (peers field is empty). | No |
origins | OriginAuthenticationMethod[] | Deprecated. Please use security/v1beta1/RequestAuthentication instead.
List of authentication methods that can be used for origin authentication.
Similar to peers, these will be evaluated in order; the first validate one
will be used to set origin identity and attributes (i.e request.auth.user,
request.auth.issuer etc). If none of these methods pass, request will be
rejected with authentication failed error (401).
A method may be skipped, depends on its trigger rule. If all of these methods
are skipped, origin authentication will be ignored, as if it is not defined.
Leave the list empty if origin authentication is not required. | No |
originIsOptional | bool | Deprecated. Please use security/v1beta1/RequestAuthentication instead.
Set this flag to true to accept request (for origin authentication perspective),
even when none of the origin authentication methods defined above satisfied.
Typically, this is used to delay the rejection decision to next layer (e.g
authorization).
This flag is ignored if no authentication defined for origin (origins field is empty). | No |
principalBinding | PrincipalBinding | Deprecated. Source principal is always from peer, and request principal is always from
RequestAuthentication.
Define whether peer or origin identity should be use for principal. Default
value is USE_PEER.
If peer (or origin) identity is not available, either because of peer/origin
authentication is not defined, or failed, principal will be left unset.
In other words, binding rule does not affect the decision to accept or
reject request. | No |