Closed ttu closed 4 years ago
Hello. Do you need some help for that one? Maybe the work can be divided.
Yes, all help is appreciated :)
There is still 2 things to check.
Although middleware changes the mothod to GET https://github.com/ttu/dotnet-fake-json-server/blob/update-to-core-30/FakeServer/Common/ETagMiddleware.cs#L85
PUT method is still executed from the controller https://github.com/ttu/dotnet-fake-json-server/blob/update-to-core-30/FakeServer/Controllers/DynamicController.cs#L258
Not sure if there will be any easy solution for ETagMiddleware, but even if we dont find any, I think we can release this and open a new issue for that problem.
I can start to have a look at Swagger's AuthTokenOperations this week. Can you tell me how it is supposed to work with .NET Core 2.2? So that I can reproduce the issue with .NET Core 3.1
Important part is to get AddAuthorizationHeaderParameterOperationFilter
working, so it will show the input for adding Bearer token to Header.
Apparently some Swagger update has broken the AuthTokenOperations
functionality in the master branch.
This is how it was supposed to work.
It adds 2 endpoints under Authentication tag. One for generating the token and one for logging out (blacklisting the token).
Generating the token is same as this:
curl -X POST -H 'content-type: multipart/form-data' -F username=admin -F password=root http://localhost:57603/token
Request from Swagger comes correctly to TokenProviderMiddleware
, but Swagger won't show the response..
Checked that i was working in the old version (end of 2017) before Swagger was updated
git checkout 085c7ab2
So you can check if you get it working, but doesn't matter if not. We can just open an issue of this as well and fix it later.
Any issues I can help with @ttu ?
@khurrampunjwani Hi! ETagMiddleware problem needs some inspecting.
ETagMiddleware doesn't work with PUT-methods anymore. Although middleware changes the mothod to GET https://github.com/ttu/dotnet-fake-json-server/blob/update-to-core-30/FakeServer/Common/ETagMiddleware.cs#L85
PUT method is still executed from the controller https://github.com/ttu/dotnet-fake-json-server/blob/update-to-core-30/FakeServer/Controllers/DynamicController.cs#L258
This can reproduce it with test GetItem_ETag_Cached_Put
. All ideas are welcome :)
Migration guide: https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio
Branch: https://github.com/ttu/dotnet-fake-json-server/tree/update-to-core-30
New System.Text.Json doesn't support all serializations required by Fake Server, so have to use NewtonsoftJson.
TODO: [ ] Fix Swagger Authentication filters [x] Fix InputFormatters / Consumes attribute to accept different media types (merge json) [x] ETagMiddleware doesn't work with PUT methods. Middleware can't change request's method to GET and verify original data.