My setup is as follows:
- Rest APIs (Spring boot)
- Front-end application (Angular 8)
- Auth Server (Keycloak)
Current scenario:
- User enters the username and password in the angular login page.
- Angular makes a POST request and gets the access token, refresh token etc. from keycloak server.
- In all subsequent request to rest api server(which is bearer only), the access token is passed in header as "Authorization: Bearer <ACCESS_TOKEN>"
- Rest api looks at the role of the user and based on that either returns the desired data or throws a 403 Forbidden exception.
What I want: To authenticate external users using an api-key and then add rate-limiting to it. For that, i am using Kong API Gateway. For internal or trusted users that login through the angular app, the existing access token flow should work.
Issue: When using apikey in Kong, it does pass the Kong's authentication but the rest api server still expects an access token and hence get the 401 unauthorized error.