- JWT authentication
- Role based authorization
- .NET 9 Api (controller based)
- No database (used List collection for storing and retrieving the user data)
Clone the repository, open it in VS Code, run the command dotnet run.
User:
username: user
password: user123
Admin
username: admin
password: admin123Note: you can aslo test the end points from JwtDotnet9.http file. Make sure to install Rest Client extenion for Vs Code. If you are using Visual Studio 2022, then it is integrated with it.
POST http://localhost:5163/accounts/login
Content-Type: application/json
{
"username":"admin",
"password":"admin123"
}GET http://localhost:5163/weatherforecast/
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImFkbWluIiwianRpIjoiYjU0ODY3YTgtM2QwZS00N2NkLThiMWQtZjU3ZDJjOTY5MmQzIiwicm9sZSI6IkFkbWluIiwibmJmIjoxNzQ3NTY2MjA4LCJleHAiOjE3NDc1NjcxMDgsImlhdCI6MTc0NzU2NjIwOCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo1MTYzIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo1MTYzIn0.OjqtxwC5z-SWuVdPQjMb_BgffEVyMqbeOlNc3NgMcjwGood luck..