I'm converting a WebApi to an Azure Function app. It authenticates using a SecurityToken in the header. With the api, I put in an attribute to call the authentication logic, but this doesn't work in Azure functions.
[ApiAuthentication()]
[FunctionName("GetConfig")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get")]HttpRequestMessage req, TraceWriter log)
{
}
Is there a way to make this work, or is there a better way?
ASP.Net WebAPI attributes don't work in Azure Functions (they're two separate frameworks, although AF is currently implemented on top of WebAPI, it doesn't expose that to the surface). You have some options:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With