Giter VIP home page Giter VIP logo

aspnetcore2jwtauthentication's Introduction

Jwt Authentication without ASP.NET Core Identity 2.2.104

jwtauth

A Jwt based authentication sample for ASP.NET Core 2.2.102 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 2.2.102 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.

How to run the Angular 7.0+ Client

  • Update all of the outdated global dependencies using the npm update -g command.
  • Install the Angular-CLI.
  • Open a command prompt console and then navigate to src/ASPNETCore2JwtAuthentication.AngularClient/ folder.
  • Now run the following commands:
npm update -g
npm 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 restore
dotnet watch run

aspnetcore2jwtauthentication's People

Contributors

vahidn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.