简体   繁体   中英

Using azure API management to redirect to a URL

I have an azure function that performs a redirect to a login journey and I want to know if it is possible to protect this function with the API management tool. I am able to redirect to the azure function's URL and everything works nicely but because the API Management service requires a subscription key I can not do a simple redirect to the URL as this loses any headers.

var responseMessage = new HttpResponseMessage(HttpStatusCode.Redirect);
            responseMessage.Headers.Location = new Uri(redirectUri);

            return responseMessage;

This is currently all the azure function is doing to try and give some context so can API management do this for me or is it simply not possible?

If all you want is to put APIM in front of the function and you don't want to manage APIM subscription keys, you could create new open product ( https://docs.microsoft.com/en-us/azure/api-management/api-management-key-concepts#a-nameproducts-a-products ), add your API to that product and mark it as published. Once any API is added to an open product it becomes possible to call that API without providing subscription key. It's effectively becomes anonymous API since APIM will not be able to identify users making calls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM