My api is protected by 2 means: JWT validation and Ocp-Apim-Subscription-Key
requirement.
The Azure AADB2C JWT asserts that the user is who he says he is while guaranteeing that he proved such identity (user+password) recently.
The Ocp-Apim-Subscription-Key
proves that A user subscribed to the referred api/product.
The problem is: how can I assert that the Ocp-Apim-Subscription-Key
being provided belongs to the user informed by the JWT? What if the "hacker" was able to steal a credential from partner A and steal a Ocp-Apim-Subscription-Key
from partner B?
EDIT 1 - Here is what I did:
- Created 2 accounts A and B
- Created a api that requires OCP key and validates JWT
- Created a product P for that API
- Subscribed A to P
- Got a JWT using B's credential
- B "stole" A's subscription Key
- B successfully consumed product P using his own JWT and A's subscription key