Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionInvocationFilterAttribute preview #2496

Open
giotab opened this issue May 23, 2020 · 13 comments
Open

FunctionInvocationFilterAttribute preview #2496

giotab opened this issue May 23, 2020 · 13 comments
Labels
Feature: Function Filters Request for Function Filters to be a supported feature
Milestone

Comments

@giotab
Copy link

giotab commented May 23, 2020

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

@ghost ghost added the Needs: Triage 🔍 label May 23, 2020
@jamesharling
Copy link

jamesharling commented Jun 8, 2020

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

@giotab
Copy link
Author

giotab commented Jun 10, 2020

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.

@GeraltTheWolf
Copy link

Is there any progress on this issue?

@v-anvari
Copy link

Please find the discussion in #1284

@v-anvari v-anvari added Feature Feature: Function Filters Request for Function Filters to be a supported feature and removed Feature Needs: Triage (Functions) labels Nov 17, 2020
@v-anvari v-anvari added this to the Backlog milestone Nov 19, 2020
@gwinnem
Copy link

gwinnem commented Feb 13, 2021

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 ?

@appayele2900
Copy link

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

@jlgrau
Copy link

jlgrau commented Jul 26, 2022

any progress on this issue?

@JDECOMBE
Copy link

JDECOMBE commented Feb 3, 2023

Any progress on this issue ?

@codechavez
Copy link

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.

@Richard88christie
Copy link

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

@ddelapasseOII
Copy link

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

@Sti2nd
Copy link

Sti2nd commented Apr 21, 2023

For everyone's information; the last update on filters from Microsoft is that it is indeed dead and should be replaced with .NET middleware. #2825

Unfortunately, to use .NET middleware one must rewrite to use isolated worker process...

@RachidAZ
Copy link

facing the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Function Filters Request for Function Filters to be a supported feature
Projects
None yet
Development

No branches or pull requests