0517 - 0523


# 0517 - 0523

# 0518 - JWT(Json Web Token)

Json ํฌ๋งท์„ ์ด์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์— ๋Œ€ํ•œ ์†์„ฑ์„ ์ €์žฅํ•˜๋Š” Claim ๊ธฐ๋ฐ˜์˜ Web Token์ด๋‹ค.
ํ† ํฐ ์ž์ฒด๋ฅผ ์ •๋ณด๋กœ ์‚ฌ์šฉํ•˜๋Š” Self-Contained ๋ฐฉ์‹
ํ† ํฐ ๊ธฐ๋ฐ˜์˜ ์ธ์ฆ์‹œ์Šคํ…œ์—์„œ ์ฃผ๋กœ ์‚ฌ์šฉํ•œ๋‹ค.

# ๊ตฌ์กฐ

HEADER.PAYLOAD.SIGNATURE

ํ—ค๋”(Header), ํŽ˜์ด๋กœ๋“œ(Payload), ์„œ๋ช…(Signature) ์„ธ๋ถ€๋ถ„์„ ์ ์œผ๋กœ ๊ตฌ๋ถ„ํ•˜๋Š” ๊ตฌ์กฐ

  • Header : typ๊ณผ alg ์ •๋ณด๋กœ ๊ตฌ์„ฑ. Signature๋ฅผ ํ•ด์‹ฑํ•˜๊ธฐ ์œ„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ง€์ •

    • typ : ํ† ํฐ์˜ ํƒ€์ž…์„ ์ง€์ • ex) JWT
    • alg : ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฐฉ์‹์„ ์ง€์ •ํ•˜๋ฉฐ, ์„œ๋ช…(Signature) ๋ฐ ํ† ํฐ ๊ฒ€์ฆ์— ์‚ฌ์šฉ ex) HS256(SHA256) ๋˜๋Š” RSA
  • PAYLOAD : ํ† ํฐ์—์„œ ์‚ฌ์šฉํ•  ์ •๋ณด์˜ ์กฐ๊ฐ๋“ค์ธ ํด๋ ˆ์ž„(Claim)์„ ๋‹ด๋Š”๋‹ค. ํด๋ ˆ์ž„์€ ์ด 3๊ฐ€์ง€๋กœ ๋‚˜๋ˆ„์–ด์ง€๋ฉฐ, Json(Key/Value) ํ˜•ํƒœ

    1. ๋“ฑ๋ก๋œ ํด๋ ˆ์ž„(Registered Claim)
      ํ† ํฐ ์ •๋ณด๋ฅผ ํ‘œํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ์ด๋ฏธ ์ •ํ•ด์ง„ ์ข…๋ฅ˜์˜ ๋ฐ์ดํ„ฐ

      • iss: ํ† ํฐ ๋ฐœ๊ธ‰์ž(issuer)
      • sub: ํ† ํฐ ์ œ๋ชฉ(subject)
      • aud: ํ† ํฐ ๋Œ€์ƒ์ž(audience)
      • exp: ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„(expiration), NumericDate ํ˜•์‹์œผ๋กœ ๋˜์–ด ์žˆ์–ด์•ผ ํ•จ ex) 1480849147370
      • nbf: ํ† ํฐ ํ™œ์„ฑ ๋‚ ์งœ(not before), ์ด ๋‚ ์ด ์ง€๋‚˜๊ธฐ ์ „์˜ ํ† ํฐ์€ ํ™œ์„ฑํ™”๋˜์ง€ ์•Š์Œ
      • iat: ํ† ํฐ ๋ฐœ๊ธ‰ ์‹œ๊ฐ„(issued at), ํ† ํฐ ๋ฐœ๊ธ‰ ์ดํ›„์˜ ๊ฒฝ๊ณผ ์‹œ๊ฐ„์„ ์•Œ ์ˆ˜ ์žˆ์Œ
      • jti: JWT ํ† ํฐ ์‹๋ณ„์ž(JWT ID), ์ค‘๋ณต ๋ฐฉ์ง€๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋ฉฐ, ์ผํšŒ์šฉ ํ† ํฐ(Access Token) ๋“ฑ์— ์‚ฌ์šฉ
    2. ๊ณต๊ฐœ ํด๋ ˆ์ž„(Public Claim)
      ์‚ฌ์šฉ์ž ์ •์˜ ํด๋ ˆ์ž„์œผ๋กœ, ๊ณต๊ฐœ์šฉ ์ •๋ณด๋ฅผ ์œ„ํ•ด์‚ฌ์šฉ ์ถฉ๋™๋ฐœ์ง€๋ฅผ ์œ„ํ•ด URI ํฌ๋งท

      { "https://mangkyu.tistory.com": true }
      
    3. ๋น„๊ณต๊ฐœ ํด๋ ˆ์ž„(Private Claim)
      ์‚ฌ์šฉ์ž ์ •์˜ ํด๋ ˆ์ž„์œผ๋กœ, ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด์— ์ž„์˜๋กœ ์ง€์ •ํ•œ ์ •๋ณด๋ฅผ ์ €์žฅ

      { "token_type": access }
      
  • Signature(์„œ๋ช…) : ํ† ํฐ์„ ์ธ์ฝ”๋”ฉํ•˜๊ฑฐ๋‚˜ ์œ ํšจ์„ฑ ๊ฒ€์ฆ์„ ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๊ณ ์œ ํ•œ ์•”ํ˜ธํ™” ์ฝ”๋“œ. ํ—ค๋”์™€ ํŽ˜์ด๋กœ๋“œ์˜ ๊ฐ’์„ ๊ฐ๊ฐ base64๋กœ ์ธ์ฝ”๋”ฉํ•˜๊ณ , ์ธ์ฝ”๋”ฉํ•œ ๊ฐ’์„ ๋น„๋ฐ€ ํ‚ค๋ฅผ ์ด์šฉํ•ด ํ—ค๋”์—์„œ ์ •์˜ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ํ•ด์‹ฑ์„ ํ•˜๊ณ , ์ด ๊ฐ’์„ ๋‹ค์‹œ base64๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ์ƒ์„ฑํ•œ๋‹ค.

# ํ† ํฐ HTTP ํ†ต์‹ 

์ƒ์„ฑ๋œ ํ† ํฐ์€ HTTP ํ†ต์‹ ์„ ํ•  ๋•Œ ์ผ๋ฐ˜์ ์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉ๋œ๋‹ค.

{ 
 "Authorization": "Bearer {์ƒ์„ฑ๋œ ํ† ํฐ ๊ฐ’}",
 }

# JWT ๋‹จ์  ๋ฐ ๊ณ ๋ ค์‚ฌํ•ญ

  • Self-contained: ํ† ํฐ ์ž์ฒด์— ์ •๋ณด๋ฅผ ๋‹ด๊ณ  ์žˆ์œผ๋ฏ€๋กœ ์–‘๋‚ ์˜ ๊ฒ€์ด ๋  ์ˆ˜ ์žˆ๋‹ค.
  • ํ† ํฐ ๊ธธ์ด: ํ† ํฐ์˜ ํŽ˜์ด๋กœ๋“œ(Payload)์— 3์ข…๋ฅ˜์˜ ํด๋ ˆ์ž„์„ ์ €์žฅํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ์ •๋ณด๊ฐ€ ๋งŽ์•„์งˆ์ˆ˜๋ก ํ† ํฐ์˜ ๊ธธ์ด๊ฐ€ ๋Š˜์–ด๋‚˜ ๋„คํŠธ์›Œํฌ์— ๋ถ€ํ•˜๋ฅผ ์ค„ ์ˆ˜ ์žˆ๋‹ค.
  • Payload ์ธ์ฝ”๋”ฉ: ํŽ˜์ด๋กœ๋“œ(Payload) ์ž์ฒด๋Š” ์•”ํ˜ธํ™” ๋œ ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, BASE64๋กœ ์ธ์ฝ”๋”ฉ ๋œ ๊ฒƒ์ด๋‹ค. ์ค‘๊ฐ„์— Payload๋ฅผ ํƒˆ์ทจํ•˜์—ฌ ๋””์ฝ”๋”ฉํ•˜๋ฉด ๋ฐ์ดํ„ฐ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, JWE๋กœ ์•”ํ˜ธํ™”ํ•˜๊ฑฐ๋‚˜ Payload์— ์ค‘์š” ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์ง€ ์•Š์•„์•ผ ํ•œ๋‹ค.
  • Stateless: JWT๋Š” ์ƒํƒœ๋ฅผ ์ €์žฅํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ํ•œ๋ฒˆ ๋งŒ๋“ค์–ด์ง€๋ฉด ์ œ์–ด๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค. ์ฆ‰, ํ† ํฐ์„ ์ž„์˜๋กœ ์‚ญ์ œํ•˜๋Š” ๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋ฏ€๋กœ ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„์„ ๊ผญ ๋„ฃ์–ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.
  • Tore Token: ํ† ํฐ์€ ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ ๊ด€๋ฆฌํ•ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ํ† ํฐ์„ ์ €์žฅํ•ด์•ผ ํ•œ๋‹ค.

# 0519 - ์ŠคํŠธ๋ ˆ์Šค ํ…Œ์ŠคํŠธ ํˆด Artillery ์‚ฌ์šฉ

# ์ŠคํŠธ๋ ˆ์Šค ํ…Œ์ŠคํŠธ ํˆด๋กœ ์„ฑ๋Šฅ ์ธก์ •ํ•˜๊ธฐ

  1. ์„ค์น˜
npm install -g artillery@๋ฒ„์ „
  1. ์„ค์ • yaml ์ž‘์„ฑ
config:
  target: "http://34.64.171.115"
  phases:
    - duration: 60
      arrivalRate: 1
      name: Warm up
scenarios:
  - name: "just get hash"
    flow:
      - get:
          url: "/hash/123"

This code describes a load phase which lasts 300 seconds (or 5 minutes), where 10 new virtual users will be created every second.

  1. ์‹คํ–‰
artillery run --output report.json ./cpu-test.yaml
  1. json to html
artillery report ./report.json

# doc

https://artillery.io/docs/guides/overview/welcome.html


# 0521 - ๋นŒ๋“œ ๊ด€๋ฆฌ ๋„๊ตฌ ๋น„๊ต

# ๋นŒ๋“œ ๊ด€๋ฆฌ ๋„๊ตฌ๋ž€?

๋นŒ๋“œ ๋„๊ตฌ๋Š” ๋นŒ๋“œ ์ž๋™ํ™”๋ฅผ ์‹œ์ผœ์ฃผ๋Š” ์‹คํ–‰๊ฐ€๋Šฅํ•œ ํ”„๋กœ๊ทธ๋žจ
๋นŒ๋“œ ์ž๋™ํ™”๋ž€ ์‹คํ–‰๊ฐ€๋Šฅํ•œ ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๊ณผ์ •์œผ๋กœ์จ ์ฝ”๋“œ๋ฅผ ์ปดํŒŒ์ผํ•ด์„œ binary code๋กœ ๋งŒ๋“ค๊ณ  ํŒจํ‚ค์ง•ํ•˜๋ฉฐ ์ฝ”๋“œ๋ฅผ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์‹คํ–‰๊ฐ€๋Šฅํ•œ ํ”„๋กœ๊ทธ๋žจ์ด ๋‚˜์˜ค๊ธฐ ๊นŒ์ง€์˜ ๊ณผ์ •

# Maven

  • ๋นŒ๋“œ ์ค‘์ธ ํ”„๋กœ์ ํŠธ, ๋นŒ๋“œ ์ˆœ์„œ, ๋‹ค์–‘ํ•œ ์™ธ๋ถ€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ข…์†์„ฑ ๊ด€๊ณ„๋ฅผ pom.xmlํŒŒ์ผ์— ๋ช…์‹œ

# Gradle

  • Groovy ์–ธ์–ด๋ฅผ ์‚ฌ์šฉํ•œ Domain-specific-language๋ฅผ ์‚ฌ์šฉ

# ์ฐจ์ด์ 

  • Gradle์€ ์ž‘์—… ์˜์กด์„ฑ ๊ทธ๋ž˜ํ”„๋ฅผ ๊ธฐ๋ฐ˜, Maven์€ ๊ณ ์ •์ ์ด๊ณ  ์„ ํ˜•์ ์ธ ๋‹จ๊ณ„์˜ ๋ชจ๋ธ์„ ๊ธฐ๋ฐ˜
  • Gradle์€ ์—…๋ฐ์ดํŠธ ์—ฌ๋ถ€๋ฅผ ์ฒดํฌ incremental build๋ฅผ ํ—ˆ์šฉ
    => ๋นŒ๋“œ ์‹œ๊ฐ„ ๋‹จ์ถ•
  • ๋ฉ€ํ‹ฐ ํ”„๋กœ์ ํŠธ์˜ ๊ฒฝ์šฐ maven์€ ํŠน์ • ์„ค์ •์„ ๋‹ค๋ฅธ ๋ชจ๋“ˆ์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์ƒ์† ๋ฐ›์•„์•ผ ํ•˜์ง€๋งŒ, gradle์€ ์„ค์ • ์ฃผ์ž… ๋ฐฉ์‹์„ ์ œ๊ณต
  • gradle์€ concurrent์— ์•ˆ์ „ํ•œ ์บ์‹œ๋ฅผ ํ—ˆ์šฉ
    => 2๊ฐœ ์ด์ƒ์˜ ํ”„๋กœ์ ํŠธ์—์„œ ๋™์ผํ•œ ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ, ์„œ๋กœ overwirte๋˜์ง€ ์•Š๋„๋ก checksum ๊ธฐ๋ฐ˜์˜ ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ์บ์‹œ๋ฅผ repository์™€ ๋™๊ธฐํ™” ๊ฐ€๋Šฅ

# 0523 - M1, RC, GA

# ์Šคํ”„๋ง์˜ ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „์˜ RC, GA, M1(2,3)

# M1(Milestone 1)

  • ํ”„๋ฆฌ ์•ŒํŒŒ ๋‹จ๊ณ„์— ์žˆ๋Š” ํ•œ ์ค‘๋ฅ˜. ํŠน์ •ํ•œ ์ง‘ํ•ฉ์˜ ๊ธฐ๋Šฅ์ด ํฌํ•จ๋˜๋ฉฐ ๊ธฐ๋Šฅ์ด ์™„์„ฑ๋˜์ž๋งˆ์ž ๊ณต๊ฐœ

# RC(Release Candidate)

  • ๋งˆ์ง€๋ง‰ ์ œํ’ˆ์ด ๋  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋Š” ๋ฒ ํƒ€ ๋ฒ„์ „์œผ๋กœ, ์ƒ๋‹นํ•œ ๋ฒ„๊ทธ๊ฐ€ ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์œผ๋ฉด ์ถœ์‹œํ•  ์ค€๋น„๊ฐ€ ๋˜์—ˆ์Œ์„ ์˜๋ฏธ

# GA(General Availability)

  • ํ•„์š”ํ•œ ๋ชจ๋“  ์ƒ์—…ํ™” ํ™œ๋™์ด ์™„๋ฃŒ๋˜์–ด ์›น์ด๋‚˜ ๋ฌผ๋ฆฌ ๋งค์ฒด๋ฅผ ํ†ตํ•ด ์‹œ์žฅ์—์„œ ์ด์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋จ์„ ์˜๋ฏธ
Last update: July 22, 2021 19:09
Contributors: jaesungahn91