Skip to content

im-ashar/IdentitySetupWithJwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Identity Setup with JWT in .NET 9

This repository contains a template for setting up JWT token authentication with ASP.NET Core Identity using Entity Framework Core in a .NET 9 Web API project. The template is designed to be imported into Visual Studio 2022 for quick and easy project initialization.

Features

  • JWT Authentication with Identity: Integrated JWT token authentication using ASP.NET Core Identity and Entity Framework Core.

  • Options and Result Pattern: Implementation of the Options and Result pattern for cleaner, more maintainable code.

  • Global Exception Handling: A Global Exception Handler is implemented to catch and handle exceptions throughout the API.

Getting Started

Prerequisites

  • .NET 9 SDK: Ensure you have the .NET 9 SDK installed on your machine.
  • Visual Studio 2022: The template is designed to be imported into Visual Studio 2022.

Installation

  1. Install the Template:

    • dotnet new install IdentitySetupWithJwt::1.0.2

    • Now you will be able to see the template in the Create New Project menu.

  2. Create a New Project:

    • In Visual Studio 2022, create a new project using the installed template.
    • The project will be initialized with JWT authentication, Identity setup, and all other features.

Project Structure

  • Controllers: Contains the Web API controllers.
  • Services: Business logic services.
  • Data: Entity Framework Core setup and migrations.
  • Options: Configuration options using the Options pattern.
  • GlobalExceptionHandler: Middleware for handling exceptions globally.

Usage

  • JWT Authentication: The project is pre-configured with JWT authentication using ASP.NET Core Identity. Customize as needed for your application's requirements.

  • Entity Framework Core: The template includes EF Core setup for Identity. Migrations and database context are already configured.

  • Global Exception Handling: Exceptions are caught and handled by the Global Exception Handler middleware.

Contributing

If you want to contribute to this project, feel free to fork the repository and submit a pull request.

License

This project is licensed under the MIT License. For more details, see the full MIT License text.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages