This project demonstrates a secure ASP.NET Web API implementing Master-Details CRUD functionality with JWT-based authentication.
- ASP.NET Web API
- JWT Authentication & Authorization
- Entity Framework
- SQL Server or LocalDB
- Master-Details Entity Relationship
- CRUD Endpoints
- Swagger UI with JWT support
- ASP.NET
- Entity Framework
- Microsoft IdentityModel.Tokens
- System.IdentityModel.Tokens.Jwt
- Swagger
- .NET 8 SDK
- Visual Studio 2022
- SQL Server or LocalDB
git clone https://github.com/smraju115/MasterDetails-WebAPI-JWT.git
c
Configure appsettings.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=ProjectDb;Trusted_Connection=True;"
},
"JwtSettings": {
"SecretKey": "YourStrongSecretKey123456!",
"Issuer": "your-app",
"Audience": "your-app-users",
"ExpiryMinutes": 60
}
}
4. Run Migrations & Create DB
dotnet ef database update
5. Run the Application
🔐 JWT Authentication
🔑 Login Endpoint
🧠 Project Structure
📦MasterDetails-WebAPI-JWT
┣ 📁Controllers
┣ 📁Models
┣ 📁DTOs
┣ 📁Data
┣ 📜Program.cs
┗ 📜appsettings.json
JWT tokens are signed with a secure symmetric key
Protected endpoints require [Authorize] attribute
Role-based authorization
📄 License
This project is licensed under the MIT License.
👨💻 Author
Created by S. M. SHAHAJALAL RAJU