This code is an implementation of JWT Role Base Authorization with Custom Tables.
We are using EntityFramework with Sql. In order to use MySql, you just have to use options.UseMySql in ConfigureServices of Startup.cs instead of options.UseSql.
Use Cases:
- When a user logs in with valid credentials, a token is returned.
- When user tries to access an Api controller action decorated with [Authorize] with an invalid token or no token at all. It will return 401 Unauthorized status code.
- When user tries to access an action whom access is only provided to admin(with a valid token though), it will return a 403 Forbidden status code.