Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.38 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.38 KB

How to add User Roles & authenticate w Azure using JWT ?

.NET 6 Web API (Create JSON Web Tokens (JWT)) (User Registration / Login / Authentication)

JWTWebApi_Program cs

  1. Add UserDto.cs in App= (Username, Password)

JWTWebApi_User UserDto cs

  1. Add User.cs in App = (Username, PasswordHash, PasswordSalt)

  2. Add Api Controller-Empty (AuthController.cs) into Controller=

JWTWebApi_AuthController cs

(Create a method for CreatePasswordHash() method ) (Create a method for VerifyPasswordHash() method ) (Create a method to register user/ [HttpPost("register")]) (Create a method to login user/ [HttpPost("login")] (Create a method for CreateToken() method )

  1. Add a new section to AppSettings.json= (Add "AppSettings"{Token: ...............}.)

  2. Add a constructor (public AuthController{IConfiguration ...}) into AuthController.cs (Continue to create a method for CreateToken() method )

  3. Controll jwt token at jwt.io internet side