azure-webjobs-sdk icon indicating copy to clipboard operation
azure-webjobs-sdk copied to clipboard

FunctionInvocationFilterAttribute preview

Open giotab opened this issue 4 years ago • 13 comments

FunctionInvocationFilterAttribute has been in "preview" and hence "obsolete" since 2018.

Are there alternatives or plans to finalize it?

Repro steps

  1. Create azure functions project in dotnet

  2. 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

giotab avatar May 23 '20 07:05 giotab

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 avatar Jun 08 '20 08:06 jamesharling

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.

giotab avatar Jun 10 '20 13:06 giotab

Is there any progress on this issue?

GeraltTheWolf avatar Sep 01 '20 22:09 GeraltTheWolf

Please find the discussion in #1284

v-anvari avatar Nov 11 '20 09:11 v-anvari

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 ?

gwinnem avatar Feb 13 '21 08:02 gwinnem

Still I am seeing obsolete and deprecated. Is there any update on this?

appayele2900 avatar Jan 17 '22 12:01 appayele2900

any progress on this issue?

jlgrau avatar Jul 26 '22 14:07 jlgrau

Any progress on this issue ?

JDECOMBE avatar Feb 03 '23 16:02 JDECOMBE

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.

codechavez avatar Feb 14 '23 22:02 codechavez

Are there any alternatives that I can use? Since this is still obsolete?

Richard88christie avatar Feb 20 '23 07:02 Richard88christie

Any update? We need a solution and I hate to use something that starts out obsolete.

ddelapasseOII avatar Feb 21 '23 14:02 ddelapasseOII

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...

Sti2nd avatar Apr 21 '23 10:04 Sti2nd

facing the same.

RachidAZ avatar Feb 26 '24 13:02 RachidAZ