Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

🔐 SecureAuthLab

A secure authentication Web API built with ASP.NET Core (.NET 10) that demonstrates modern authentication and authorization techniques using JWT, Refresh Tokens, and Entity Framework Core.

This project follows modern backend development practices and serves as the backend for the SecureAuthLab.React frontend application.


✨ Features

  • ✅ User Registration
  • ✅ Secure Login
  • ✅ JWT Authentication
  • ✅ Refresh Token Rotation
  • ✅ Protected API Endpoints
  • ✅ Logout Endpoint
  • ✅ Password Hashing
  • ✅ Entity Framework Core
  • ✅ SQL Server Integration
  • ✅ Swagger Documentation
  • ✅ CORS Configuration
  • ✅ Configuration using appsettings.json

🛠️ Technology Stack

TechnologyVersion
.NET10
ASP.NET Core Web API.NET 10
Entity Framework CoreLatest
SQL ServerLatest
JWT Bearer Authentication
Swagger / OpenAPI

📂 Project Structure

SecureAuthLab
│
├── Controllers
├── Data
├── DTOs
├── Models
├── Services
├── Migrations
├── Program.cs
├── appsettings.json
└── SecureAuthLab.csproj

🔐 Authentication Flow

Client Login
│
▼
POST /api/auth/login
│
▼
JWT + Refresh Token
│
▼
Store Tokens
│
▼
Access Protected APIs
│
▼
JWT Expires
│
▼
POST /api/auth/refresh-token
│
▼
Generate New JWT
│
▼
Retry Original Request

📌 API Endpoints

MethodEndpointDescription
POST/api/auth/registerRegister a new user
POST/api/auth/loginAuthenticate user
POST/api/auth/refresh-tokenGenerate a new JWT
POST/api/auth/logoutLogout user
GET/api/auth/profileGet authenticated user profile

🚀 Getting Started

Clone the repository

git clone https://github.com/amjadaz8s5-dev/SecureAuthLab.git

Open the solution

SecureAuthLab.slnx

Configure the database

Update the connection string in:

appsettings.json

Example:

"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=SecureAuthLab;Trusted_Connection=True;TrustServerCertificate=True;"
}

Apply Migrations

dotnet ef database update

Run the project

dotnet run

🔗 Frontend

The React frontend is available in a separate repository:

https://github.com/amjadaz8s5-dev/SecureAuthLab.React


📚 What This Project Demonstrates

  • ASP.NET Core Web API Development
  • JWT Authentication
  • Refresh Token Rotation
  • Secure Password Hashing
  • Entity Framework Core
  • SQL Server
  • RESTful API Design
  • Dependency Injection
  • Authentication & Authorization
  • Swagger / OpenAPI Documentation

📈 Future Improvements

  • Role-Based Authorization (RBAC)
  • Email Verification
  • Forgot Password
  • Password Reset
  • Account Lockout
  • Two-Factor Authentication (2FA)
  • Serilog Logging
  • Docker Support
  • Unit & Integration Testing
  • CI/CD Pipeline
  • Redis Token Blacklisting

👨‍💻 Author

Amjad Ali Khan

Senior Full Stack .NET Developer

Technologies

  • ASP.NET Core
  • .NET
  • React
  • React Native
  • SQL Server
  • AWS

GitHub:

https://github.com/amjadaz8s5-dev


📄 License

This project is developed for educational and portfolio purposes.

About

ASP.NET Core (.NET 10) Web API demonstrating JWT authentication, refresh token rotation, Entity Framework Core, and secure REST API development.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages