Relate many-to-one user/consumer, modify kong db from external service


I figured I should write out what It is I am attempting to do in order to give some context to some of my other questions floating around the community.

I want to associate any number of devices to a user, and relate the two based on the device-uuid used in an API request.

These requests will look something like “ap1/v1/resources/{device-uuid}/…”
I want to use that {device-uuid}, perform a db/cache lookup and get the user’s id (probably a consumer) and then add that user’s ID as an http header before proxying the request to the upstream service.

Additionally, the device-uuid’s would be added to the kong database from some external service. It seems this is possible using the kong admin api, and extending it into my plugin… but I haven’t done it, or found examples yet.

The mutual tls plugin sounds like it has functionality close to this, but that is only available in enterprise. The key-auth also sounds close, or at least something i could adapt to my needs, but i have read that you cannot have multiple keys assigned to a single consumer… which would be show-stopper for my needs.

I am using kong in kubernetes. I am curious what advice the experts have to give on such a setup.

And also, thanks for all the fantastic moderating you guys do in this community! It’s certainly appreciated!