azure-webjobs-sdk
azure-webjobs-sdk copied to clipboard
FunctionInvocationFilterAttribute preview
FunctionInvocationFilterAttribute
has been in "preview" and hence "obsolete" since 2018.
Are there alternatives or plans to finalize it?
Repro steps
-
Create azure functions project in dotnet
-
Implement FunctionInvocationFilterAttribute
Expected behavior
The attribute filter has been in "preview" and hence "obsolete" since 2018. Are there any plans to finalize it?
Actual behavior
Implementing and using FunctionInvocationFilterAttribute
does not complain about obsolete class.
Known workarounds
Ignore warning
Related information
File can be found here
Also interested in an update on this. The limited functionality provided by the current Filters API and a lack of DI support means it's extremely difficult to bring HTTP APIs hosted by Azure Functions in line with those in App Services. For example, you cannot change the response code of an HTTP trigger using Filters, which is the the ideal place for cross-cutting concerns that do exactly this (auth, validation, etc.)
Also interested in an update on this. The limited functionality provided by the current Filters API and a lack of DI support means it's extremely difficult to bring HTTP APIs hosted by Azure Functions in line with those in App Services. For example, you cannot change the response code of an HTTP trigger using Filters, which is the the ideal place for cross-cutting concerns that do exactly this (auth, validation, etc.)
@jamesharling
We are using the attribute for authentication actually.
Although dependency injection is not supported through constructors/parameters, you can still use something like
request.HttpContext.RequestServices.GetRequiredService<ITokenValidator>()
(ITokenValidator is interface we created).
As for modifying the response etc., we have something like this
var claims = tokenValidator.ValidateTokenAndGetClaimsAsync(request.Headers, validAudiences).Result;
if (claims == null)
{
request.HttpContext.Response.StatusCode = 401;
request.HttpContext.Response.Body.FlushAsync();
request.HttpContext.Response.Body.Close();
throw new UnauthorizedException();
}
It works nicely, but it is annoying that it is marked as Preview for two years and hence all compilers complain about it.
Is there any progress on this issue?
Please find the discussion in #1284
OMG I have been waiting for so long, and im still writing boiler plate code in each function.. When can the community expect someone to take action and bring this issue to an end ?
Still I am seeing obsolete and deprecated. Is there any update on this?
any progress on this issue?
Any progress on this issue ?
Any progress on this issue? because I'm using it in several functions, and I would like to remove the ignore so the compiler move with it life.
Are there any alternatives that I can use? Since this is still obsolete?
Any update? We need a solution and I hate to use something that starts out obsolete.
For everyone's information; the last update on filters from Microsoft is that it is indeed dead and should be replaced with .NET middleware. https://github.com/Azure/azure-webjobs-sdk/issues/2825
Unfortunately, to use .NET middleware one must rewrite to use isolated worker process...
facing the same.