kind: RequestAuthentication
apiVersion: security.istio.io/v1beta1
metadata:
  name: request-auth-{{ .Chart.Name }}
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      app: {{ .Chart.Name }}
  jwtRules:
    - forwardOriginalToken: true
      fromHeaders:
        - name: X-Access-Token
      issuer: {{ template "issuer.officer" . }}
      jwksUri: {{ template "jwksUri.officer" . }}
    - forwardOriginalToken: true
      fromHeaders:
        - name: X-Access-Token
      issuer: {{ template "issuer.citizen" . }}
      jwksUri: {{ template "jwksUri.citizen" . }}
      {{- if .Values.keycloak.customHost }}
    - forwardOriginalToken: true
      fromHeaders:
        - name: X-Access-Token
      issuer: {{ template "custom-issuer.officer" . }}
      jwksUri: {{ template "jwksUri.officer" . }}
    - forwardOriginalToken: true
      fromHeaders:
        - name: X-Access-Token
      issuer: {{ template "custom-issuer.citizen" . }}
      jwksUri: {{ template "jwksUri.citizen" . }}
      {{- end }}