Authentication Policy
JSON Web Token (JWT) token format for authentication as defined byRFC 7519. See andOIDC 1.0 for how this is used in the wholeauthentication flow.
For example:
A JWT for any requests:
A JWT for all requests except request at path and path withprefix /status/
. This is useful to expose some paths for public access butkeep others JWT validated.
issuer: https://example.com
jwksUri: https://example.com/.well-known/jwks.json
triggerRules:
- excludedPaths:
- exact: /health_check
- prefix: /status/
A JWT only for requests at path /admin
. This is useful to only require JWTvalidation on a specific set of paths but keep others public accessible.
issuer: https://example.com
triggerRules:
- includedPaths:
- prefix: /admin
A JWT only for requests at path of prefix /status/
but except the path of/status/version
. This means for any request path with prefix /status/
except/status/version
will require a valid JWT to proceed.
Jwt.TriggerRule
Field | Type | Description | Required |
---|---|---|---|
excludedPaths | List of paths to be excluded from the request. The rule is satisfied ifrequest path does not match to any of the path in this list. | No | |
includedPaths | StringMatch[] | List of paths that the request must include. If the list is not empty, therule is satisfied if request path matches at least one of the path in the list.If the list is empty, the rule is ignored, in other words the rule is always satisfied. | No |
MutualTls
TLS authentication params.
Field | Type | Description | Required |
---|---|---|---|
allowTls | bool | WILL BE DEPRECATED, if set, will translates to TLS_PERMISSIVE mode.Set this flag to true to allow regular TLS (i.e without client x509certificate). If request carries client certificate, identity will beextracted and used (set to peer identity). Otherwise, peer identity willbe left unset.When the flag is false (default), request must have client certificate. | No |
mode | Mode | Defines the mode of mTLS authentication. | No |
Defines the acceptable connection TLS mode.
OriginAuthenticationMethod
OriginAuthenticationMethod defines authentication method/params for originauthentication. Origin could be end-user, device, delegate service etc.Currently, only JWT is supported for origin authentication.
Field | Type | Description | Required |
---|---|---|---|
jwt | Jwt | Jwt params for the method. | No |
PeerAuthenticationMethod
PeerAuthenticationMethod defines one particular type of authentication, e.gmutual TLS, JWT etc, (no authentication is one type by itself) that canbe used for peer authentication.The type can be progammatically determine by checking the type of the“params” field.
Field | Type | Description | Required |
---|---|---|---|
mtls | MutualTls (oneof) | Set if mTLS is used. | Yes |
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 beend-user, service account, device etc.
Examples:
Policy to enable mTLS for all services in namespace frod. The policy name must bedefault
, and it contains no rule for targets
.
apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
name: default
namespace: frod
spec:
peers:
- mtls:
Policy to disable mTLS for “productpage” service
Policy to require mTLS for peer authentication, and JWT for origin authenticationfor productpage:9000 except the path ‘/health_check’ . Principal is set from origin identity.
apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
name: productpage-mTLS-with-JWT
namespace: frod
spec:
- name: productpage
ports:
- number: 9000
peers:
- mtls:
origins:
- jwt:
issuer: "https://securetoken.google.com"
audiences:
jwksUri: "https://www.googleapis.com/oauth2/v1/certs"
jwtHeaders:
- "x-goog-iap-jwt-assertion"
triggerRules:
- excludedPaths:
- exact: /health_check
principalBinding: USE_ORIGIN
PortSelector
PortSelector specifies the name or number of a port to be used formatching targets for authentication policy. This is copied fromnetworking API to avoid dependency.
Field | Type | Description | Required |
---|---|---|---|
number | uint32 (oneof) | Valid port number | Yes |
name | string (oneof) | Port name | Yes |
PrincipalBinding
Associates authentication with request principal.
Name | Description |
---|---|
USE_PEER | Principal will be set to the identity from peer authentication. |
USE_ORIGIN | Principal will be set to the identity from origin authentication. |
TargetSelector
TargetSelector defines a matching rule to a workload. A workload is selectedif it is associated with the service name and service port(s) specified in the selector rule.
Field | Type | Description | Required |
---|---|---|---|
name | string | The name must be a short name from the service registry. Thefully qualified domain name will be resolved in a platform specific manner. | Yes |
ports | PortSelector[] | Specifies the ports. Note that this is the port(s) exposed by the service, not workload instance ports.For example, if a service is defined as below, then 8000 should be used, not 9000 .Leave empty to match all ports that are exposed. | No |