Posts

Showing posts with the label Security

JWT?

Image
  What is JWT? JSON Web Token (JWT) is the approach of securely transmitting data across communication channel. For authentication and authorization, it uses the technique of passing digitally signed tokens. JWT comprises of three parts: Header, Payloads and Signature. Header is used to identity the signing algorithm used and it appears like: { “ alg ”: “ HS256 ”, “ typ ”: “ JWT ”} Payload looks like: { “ Name ”: “ Ramana Reddy ,” Admin ”: “ true ”,” iat ”: “ 146565644 ”} The signature is created by Base64 encoding Header and Payload as: data = encoded ( Header ) + “.” + encoded ( Payload ) signature = HMACSHA256 ( data , secret key ); More details about JWT can be referred from  https://jwt.io/ JWT in Theory JWT authentication process can be broken into following 4 steps- 1) User is validated against database and claims are generated based on user’s role. 2) Payload containing claims or other user related data is signed with key to generate token and ...