pvjhs
pvjhs

Reputation: 709

How to use azure api management to do custom access token check and enrich data in request

All the incoming request to api management will have a token in a header, before backend service is hit token has to be verified. To verify token a GET tokenVallidationApi is to be hit and the response will tell us whether the token is valid or not. If the response exists for token validation , we have to take out few entries from response and enrich the body/header to hit the backend api. I am very new to api management tool and just figuring out how can we achieve this with azure api management?

Upvotes: 0

Views: 603

Answers (1)

PramodValavala
PramodValavala

Reputation: 6647

This is possible. You would have to implement your policies like something below

1. Validate Token For this, you would first call the validation endpoint using send-request. You could also implement caching using value caching policies for multiple requests.

The doc also highlights how you can extract value from the response body.

2. Transform Body & Headers For headers, you would use the set-header policy and for the body, you would use the set-body policy.

Upvotes: 4

Related Questions