I am having a lot of trouble with claims that are used to check user permissions in the controllers.
App structure
Our backend is .NET Core, the front end is React, and for now we only allow logging in using the google API using a google enabled email. We generate a JWT and store it on the browser's localStorage, then send it on every request. Also, there are no roles: if you are logged then you are an Admin.
The devs that did the app's "skeleton" are gone now, and it's my first time on security concerns dealing.
The new requirement
We need now to implement roles and permission, and it seems MS expects one to use Claims for this. I did this and added those claims to the jwt, then added policies on the config and it actually worked. If you have a specific claim you can access a specific controller or method, otherwise the server returns a 403 error.
But then I logged in with an actual admin role, copied the localStorage value using devtools, and then logged off and back in with a user with almost no permission. When I pasted the local storage entry (again, using devtools) I immediately got all claims and was able to access every controller and method the admin could.
It seems the proper way to go then should be using a HttpOnly, secure cookie, perhaps with "SameOrigin" set to true (not sure how this affects Single Sign On), but I do not understand how to do that. I have seen blog posts, even downloaded an app (that I could not make run but I copied code over to my app), but I keep failing. Also I don't understand if I need to do anything for the cookie to be used when checking the controller policies.
Can anyone give me a hand on this?