Korbah
❔ New .NET Core Web API app. Guidelines for setting up authentication & authorization?
Once I've verified the user's credentials using Identity, I build a JWT based on the user's permissions and return it. Then there's middleware that handles verifying the signature of the JWT is valid, and then each controller / method can use the
[Authorize]
method to limit access.
I'm super new to using Identity and JWTs in C# too but it seems to work fine50 replies
❔ New .NET Core Web API app. Guidelines for setting up authentication & authorization?
I've been using ASP.net Identity(I believe this is different than Identity Server, which definitely confused me) to handle authentication. It was a little challenging to learn since the documentation is geared towards MVC projects, but you can use the methods in a web api as well
50 replies
❔ JSON Serialization Weird Model
This makes sense - I think we should be able to make something work with the information you've given so far. Were you able to find out what source generators are? I believe that solution could make this much simpler
49 replies
❔ JSON Serialization Weird Model
Gotcha - from your initial post I thought you had other structures you'd like to be able to handle with your solution. The only time I see an Id outside of the Fields property is in the outermost
"Element"
, the others do not have an Id outside of fields in the example given.
You may be able to write a custom converter for a class that could represent the structure you've given49 replies
❔ JSON Serialization Weird Model
honestly the Element and Fields levels of the heirarchy seem superfluous
Its a little hard to suggest anything given the limited amount of information given. You've provided one example of how the data should be sent but I'm not sure how flexible you'd want your solution go be. I'd have to see more of the documentation or more examples to suggest something better if you don't want to use ToString
49 replies