This repository was archived by the owner on Aug 24, 2025. It is now read-only.
Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork100
Jwt Authentication without ASP.NET Core Identity
License
NotificationsYou must be signed in to change notification settings
VahidN/ASPNETCore2JwtAuthentication
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Jwt based authentication sample for ASP.NET Core 9x without using the Identity system. It includes:
- Users and Roles tables with a many-to-may relationship.
- A separated EF Core data layer with enabled migrations.
- An EF Core 9x based service layer.
- A Db initializer to seed the default database values.
- An account controller with Jwt and DB based login, custom logout and refresh tokens capabilities.
- 2 sample API controllers to show how user-roles can be applied and used.
- A Jwt validator service to show how to react to the server side changes to a user's info immediately.
- An Angular 7.0+ Client. It contains:
- A JWT-based Login page.
- Handling how and where to store the tokens.
- How to handle refresh tokens mechanism, using reactive timers.
- How to validate the expiration date of a token.
- How to decode an access token and extract the user's roles from it.
- Authorizing access to a module via a route guard based on the user's roles.
- How to hide or display different parts of a page based on the user's roles.
- Adding a JWT token to the HTTP requests required authorized access automatically.
- Handling server side unauthorized errors automatically.
- Update all of the outdated global dependencies using the
npm update -gcommand. - Install the
Angular-CLI. - Open a command prompt console and then navigate to src/ASPNETCore2JwtAuthentication.AngularClient/ folder.
- Now run the following commands:
npm update-gnpm install_2-ng-build-dev.bat
- Then open another command prompt console and navigate to src/ASPNETCore2JwtAuthentication.WebApp/ folder.
- Now run the following commands:
dotnet restoredotnet watch run
- Finally to browse the application, navigate tohttps://localhost:5001/AngularClient
About
Jwt Authentication without ASP.NET Core Identity
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
