Skip to content

An ASP.NET MVC Web API with user authentication, featuring secure access to API endpoints. This project utilizes token-based authentication (JWT) to manage user login, registration, and role-based access control for protecting sensitive resources.

Notifications You must be signed in to change notification settings

smraju115/Web-API-With-JWT-Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Master-Details CRUD Web API with JWT Authentication (ASP.NET 8)

This project demonstrates a secure ASP.NET Web API implementing Master-Details CRUD functionality with JWT-based authentication.


🔐 Key Features

  • ASP.NET Web API
  • JWT Authentication & Authorization
  • Entity Framework
  • SQL Server or LocalDB
  • Master-Details Entity Relationship
  • CRUD Endpoints
  • Swagger UI with JWT support

📦 Technologies Used

  • ASP.NET
  • Entity Framework
  • Microsoft IdentityModel.Tokens
  • System.IdentityModel.Tokens.Jwt
  • Swagger

🔧 Installation & Run

1. Prerequisites

  • .NET 8 SDK
  • Visual Studio 2022
  • SQL Server or LocalDB

2. Clone Repository

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

About

An ASP.NET MVC Web API with user authentication, featuring secure access to API endpoints. This project utilizes token-based authentication (JWT) to manage user login, registration, and role-based access control for protecting sensitive resources.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published