Api Key cannot be created with policy's access_rights empty

Hi,

I was trying to create an API Key pointing to a policy through apply_policies, but it fails if policy’s access_rights is empty (probably make sense since you are trying to create a key to consume services that doesn’t exist). Can anyone confirm this behavior?

The other thing I noticed was after create an API Key if I clean policy’s access_rights, the API Key still shows one of the API that at some point was in the policy, I though it was the latest to be deleted, but I’m not so sure, maybe is showing the APIs when it was created? What is the expected result here? Why the API Key still show an API in his access_rights?

Hi @Leobel_Izquierdo, I will answer your queries in parts

I was trying to create an API Key pointing to a policy through apply_policies , but it fails if policy’s access_rights is empty (probably make sense since you are trying to create a key to consume services that doesn’t exist). Can anyone confirm this behavior?

Yes. it would not work and you should get the error in the logs. Unless you are interested in enabling master keys.

The other thing I noticed was after create an API Key if I clean policy’s access_rights , the API Key still shows one of the API that at some point was in the policy, I though it was the latest to be deleted, but I’m not so sure, maybe is showing the APIs when it was created?

Did you restart the gateway after doing this? Note that Hot reload would not work for this?

What is the expected result here?

The key should retain the access rights that have been set by the policy.

Why the API Key still show an API in his access_rights ?

Unsure. What version of gateway are you using? Also, what type of auth mode is it (not that this really matters)?. Have you tried restarting the gateway to check if that fixed the issue?