#
# A ConfigMap which contains the configuration of the authservice.
# In bookinfo-with-authservice-template.yaml the authservice container is created
# with this ConfigMap volume mounted inside the container at /etc/authservice, which
# is the location where the authservice expects the file to exist.
#

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: authservice
data:
  # We listen on 0.0.0.0 since Istio 1.10, it changes the sidecar configuration only support
  # application listen on pod IP. See https://istio.io/latest/blog/2021/upcoming-networking-changes/
  # for more details.
  config.json: |
    {
      "listen_address": "0.0.0.0",
      "listen_port": "10003",
      "log_level": "trace",
      "threads": 8,
      "chains": [
        {
          "name": "idp_filter_chain",
          "filters": [
          {
            "oidc":
              {
                "authorization_uri": "{{ .Values.oidc.authorizationURI }}",
                "token_uri": "{{ .Values.oidc.tokenURI }} ",
                "callback_uri": "https://localhost:8443/productpage/oauth/callback",
                "jwks": "{\n  \"keys\": [\n    {\n      \"e\": \"AQAB\",\n      \"kty\": \"RSA\",\n      \"kid\": \"462949174f1eedf4f9f9434877be483b324140f5\",\n      \"alg\": \"RS256\",\n      \"n\": \"2BHFUUq8NqZ3pxxi_RJcSIMG5nJoZQ8Nbvf-lW5o7hJ9CmLA4SeUmDL2IVK6CSuskTPj_ohAp_gtOg3PCJvn33grPoJQu38MoMB8kDqA4U-u3A86GGEjWtk6LPo7dEkojZNQkzhZCnEMTuRMtBZXsLWNGJpY3UADA3rxnHnBP1wrSt27iXIE0C6-1N5z00R13r3L0aWC0MuAUgjI2H4dGMr8B3niJ-NjOVPCwG7xSWsCwsSitAuhPGHaDtenB23ZsFJjbuTuiguoSJ9A1qo9kzBOg32xda4derbWasu7Tk8p53PFxXDJGR_h7dM-nsJHl7lAUDqL8zOrf9XXlPTjwQ\",\n      \"use\": \"sig\"\n    },\n    {\n      \"alg\": \"RS256\",\n      \"use\": \"sig\",\n      \"e\": \"AQAB\",\n      \"kid\": \"6ef4bd908591f697a8a9b893b03e6a77eb04e51f\",\n      \"kty\": \"RSA\",\n      \"n\": \"xkgm0jU0J7SgrmmuLypjWO6J9MlF9vpRpsw84sme4EtWMUyAu4zT-X9Ten5wB9W2z0Gft5QOmFL99ueP3MeOqZsXGwW2UWVuQCpkD0bo4qDDqwbt8Cl31Qjb5RHeuvmwYpNQK_1ppb6dwlUCA2Y9AaE7UsZITlR7r5XiBNvOEZh0LTsjPcikCheAs6nPSMBbdIeM28vii1PgPYTU6x6dRBVBAExaRnRDPZZh4acgfKIpbOCMJm2tucqwYhx3Wr5Lhu56oZALK4lvP9SAgOZdG3BA48PKIdLOeiTP-DI_pHJhIn1N5lMCcmcpG3OKMvWo0tFMOGj8Or-mHqB_5I-L4w\"\n    }\n  ]\n}",
                "client_id": "{{ .Values.oidc.clientID }}",
                "client_secret": "{{ .Values.oidc.clientSecret }}",
                "scopes": [],
                "cookie_name_prefix": "productpage",
                "id_token": {
                  "preamble": "Bearer",
                  "header": "Authorization"
                },
                "logout": {
                  "path": "/authservice_logout",
                  "redirect_uri": "https://localhost:8443/some/logout/path"
                }
              }
            }
          ]
        }
      ]
    }
