Multiple credentials for basic-auth with ingress-controller

I want change KongCredential to k8s Secret
I use basic-auth multi-user

The first basic-user working correctly
But basic-user2 is not working

curl result is “{“message”:“Invalid authentication credentials”}”
kong log :

  1. basic-user2 : 10.242.0.26 - - [12/Mar/2020:00:49:11 +0000] “GET /service/health HTTP/1.1” 401 48 “-” “curl/7.29.0”
  2. basic-user : 10.242.0.26 - - [12/Mar/2020:00:49:59 +0000] “GET /service/health HTTP/1.1” 200 2 “-” “curl/7.29.0”

How can I add multiple user for basic auth?

env: kong : 2.0.2
ingress-controller : 0.7.1

apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
  annotations:
    kubernetes.io/ingress.class: a-kong
  name: basic-consumer
credentials:
- basic-user
  basic-user2
username: basic-consumer
custom_id: basic-consumer

---

apiVersion: v1
kind: Secret
metadata:
  name: basic-user
stringData:
  kongCredType: basic-auth
  username: abcuser1
  password: user1

---
apiVersion: v1
kind: Secret
metadata:
  name: basic-user2
stringData:
  kongCredType: basic-auth
  username: abcuser2
  password: user2

Can you check if the credentials are correctly created in Kong via the Admin API?

I added admin function and check credentials
1 credential works fine but over 2 credentials are not working

Am I wrong configure of credentials?

ex) add 1 credential

credentials:
- basic-user

{"next":null,"data":[{"created_at":1584060826,"consumer":{"id":"e93d9b57-3371-5a08-8e27-4b3b63a186f4"},"id":"9f424369-fd52-52d8-b940-79058b99da92","tags":null,"username":"user1","password":"2d469bac5ff20ba812718784b4721b7d3c6ec9ca"}]}

ex) add 2 credential

credentials:
- basic-user
  basic-user2

{"next":null,"data":[]}

You’ve a typo. It should be:

credentials:
- basic-user
- basic-user2

Hahaha
Thank you for your support ^^


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ