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

IFormFile/IFormFileCollection support for authenticated requests in minimal APIs #26683

Closed
Tracked by #26326
Rick-Anderson opened this issue Aug 10, 2022 · 5 comments · Fixed by #26988
Closed
Tracked by #26326
Labels

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Aug 10, 2022

IFormFile/IFormFileCollection support for authenticated requests in minimal APIs

See #26345 Code done, see #26453 can't publish until .NET 7 . See also test sample

@Rick-Anderson Rick-Anderson self-assigned this Aug 10, 2022
@Rick-Anderson Rick-Anderson changed the title .NET 7: IFormFile/IFormFileCollection support for authenticated requests in minimal APIs IFormFile/IFormFileCollection support for authenticated requests in minimal APIs Aug 25, 2022
@Rick-Anderson Rick-Anderson removed their assignment Aug 25, 2022
@Rick-Anderson
Copy link
Contributor Author

@martincostello can you update the code from #26494 to use authenticated requests?

@martincostello
Copy link
Member

Might that get a bit scope-creepy having to configure a whole app's worth of auth stuff into a non-auth sample to just go "oh, and it works in that context too now"?

It's not really relevant to the file upload functionality in of itself other than before preview 1 it was actively blocked as the security-concerns hadn't been addressed at that point.

Feels to me it's equivalent to if there was a feature that only worked on Windows for a while, and then later it also worked on other OSs. You wouldn't update the samples to prove they also now worked on the other operating systems.

Or am I misunderstanding exactly what you're asking for?

@Rick-Anderson
Copy link
Contributor Author

@martincostello do you think if we just say authenticated requests are supported, that's enough?

@martincostello
Copy link
Member

Maybe just something that points the user to consider whether they would also need to incorporate anti-forgery like in the blog post?

There is no built-in support for anti-forgery in minimal APIs. However, it can be implemented using the IAntiforgery service.

@Rick-Anderson
Copy link
Contributor Author

Might that get a bit scope-creepy having to configure a whole app's worth of auth stuff into a non-auth sample to just go "oh, and it works in that context too now"?

If I use JWT like this sample it one short file. But even that doesn't seem worth doing.

Maybe just something that points the user to consider whether they would also need to incorporate anti-forgery like in the blog post?

There is no built-in support for anti-forgery in minimal APIs. However, it can be implemented using the IAntiforgery service.

Agreed, I'll do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants