liyuntao / kong-init

Declarative configuration tool for Kong
Apache License 2.0
38 stars 8 forks source link

feat: support credentials (#1) #14

Closed cilindrox closed 6 years ago

cilindrox commented 6 years ago

Adds support for credentials just for kong v0.14+ tested for the following cases:

However is built in a generic way to support other credentials (JWT/HMAC) for example:

credentials:
  - name: jwt # plugin name
    target: admin # consumer username
    config:
      id: "bcbfb45d-e391-42bf-c2ed-94e32946753a",
      key: "a36c3049b36249a3c9f8891cb127243c",
      secret: ${ADMIN_JWT_SECRET} # you could replace secrets with ENV_VARs already supported by kong-init

This is used in the case of oauth2 applications but anything with the POST /consumers/<consumer_username>/<plugin> can use it, see acls

Note: in the case of acls adding an existing group returns a 400 instead of 409 and was not able to access the response/result body to properly handle the case however it does not break or interrupt the process just prints an error message

 ERROR kong_init::client > _credentials: 400 Bad Request using <consumer_username>/acls

Closes #8

cilindrox commented 6 years ago

cc @kuryaki who authored this