JWT(Json Web Token)

효딩딩·2022년 10월 24일
0

JWT (JSON WEB TOKEN) 이란?

  • JWT 는 JSON Web Token의 약자로 유저를 인증하고 식별하기 위한 토큰 기반 인증
  • 토큰은 세션과는 달리 서버가 아닌 클라이언트에 저장되기 떄문에 메모리나 스토리지 등을 통해 세션을 관리했던 서버의 부담을 덜어 줄 수 있음

JWT 의 특징?

  • 토큰 자체에 사용자의 권한 정보나 서비스를 사용하기 위한 정보가 포함 된다는 것
  • 데이터가 많아지면 토큰이 커질 수 있으며 토큰이 한번 발급된 이후 사용자의 정보를 바꾸더라도 토큰을 재발급하지 않는 이상 반영되지 않음.

JWT 토큰 구성

  • JWT는 세 파트로 나누어지며, 각 파트는 점로 구분하여 xxxxx.yyyyy.zzzzz 이런식으로 표현됨
  • 순서대로 헤더 (Header), 페이로드 (Payload), 서명 (Sinature)로 구성됨

JWT 프로세스

출처:
https://brunch.co.kr/@jinyoungchoi95/1
http://www.opennaru.com/opennaru-blog/jwt-json-web-token/
https://pronist.dev/143


(영문 해석)

What is JSON Web Token (JWT)?

  • JSON Web Token, is an open standard used to share security information between two parties — a client and a server.
  • Each JWT contains encoded JSON objects, including a set of claims.
  • JWTs are signed using a cryptographic algorithm to ensure that the claims cannot be altered after the token is issued.

When should you use JSON Web Tokens?

Authorization:

  • This is the most common scenario for using JWT. Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used across different domains.

Information Exchange:

  • JSON Web Tokens are a good way of securely transmitting information between parties. Because JWTs can be signed—for example, using public/private key pairs—you can be sure the senders are who they say they are. Additionally, as the signature is calculated using the header and the payload, you can also verify that the content hasn't been tampered with.

Source:
https://www.akana.com/blog/what-is-jwt
https://supertokens.com/blog/what-is-jwt
https://dev.to/kcdchennai/how-jwt-json-web-token-authentication-works-21e7

profile
어제보다 나은 나의 코딩지식

0개의 댓글