Skip to content

Instantly share code, notes, and snippets.

@incfly
Created May 27, 2022 18:56
Show Gist options
  • Save incfly/134deac9918ef380eb95f1608f26f082 to your computer and use it in GitHub Desktop.
Save incfly/134deac9918ef380eb95f1608f26f082 to your computer and use it in GitHub Desktop.
conditional-authservice
apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: httpbin
namespace: foo
spec:
selector:
matchLabels:
app: httpbin
jwtRules:
- issuer: "issuer-foo"
jwksUri: https://oidc-idp-url.com/.well-known/jwks.json
---
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: httpbin
namespace: foo
spec:
selector:
matchLabels:
app: httpbin
rules:
- from:
- source:
requestPrincipals: ["*"]
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: ext-authz
namespace: foo
spec:
selector:
matchLabels:
app: httpbin
action: CUSTOM
provider:
name: authz-exter-authz
rules:
# The rules specify when to trigger the external authorizer.
- from:
- source:
notPrincipals: ["spiffe://trust-domain.com/ns/machine-ns/sa/machine-sa"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment