I'm trying to rewrite some authorization I currently have for ASP.NET 4.6 in ASP.NET Core.
I understand that Authorization has changed a bit, and I find it difficult to implement my very simple auth strategy in ASP.NET Core.
My requirements:
Every request to the server should include a header called "key". Based on the value of that key, I will be able to query the database and check whether that key represents a regular user or an admin user. If the request does not contain a valid key, the request is not authorized.
How would I implement this in ASP.NET Core? Every example I find seems totally overkill for my needs.
In ASP.NET 4.6 I used my own custom AuthorizeAttributes to use on my controllers, e.g.
[User]
public IHttpActionResult DoSomethingOnlyUsersCanDo() {}
and
[Admin]
public IHttpActionResult DoSomethingOnlyAdminsCanDo() {}
Can I do the same in ASP.NET Core?