Upgrade to Pro — share decks privately, control downloads, hide ads and more …

STORES へのID基盤の導入と、ユーザーアカウントの移行を振り返って

STORES へのID基盤の導入と、ユーザーアカウントの移行を振り返って

Takuya Matsumoto

October 22, 2021
Tweet

More Decks by Takuya Matsumoto

Other Decks in Technology

Transcript

  1. Who? Takuya Matsumoto @upinetree • hey ࣾ • Ruby, EM

    • ☕ , " , # • ڞஶ: ݱ৔Ͱ࢖͑Δ Ruby on Rails 5 ଎श࣮ફΨΠυ, 2018 ϑϩϦμ WDW ʹͯ (2019)
  2. ࠓ೔͓࿩͢Δ͜ͱ • ωοτγϣοϓ࡞੒αʔϏε STORES ΁ͷ ID ج൫ಋೖͷ࿩ • ΍ͬͨ͜ͱ΍ۤ࿑ͨ͜͠ͱΛৼΓฦΓɺֶͼΛڞ༗ •

    ૊৫ؒௐ੔΍ίϛϡχέʔγϣϯͷ࿩͸ࠓճ͸ׂѪ ※νʔϜͷ੒ՌΛɺࢲ͕୅ද͓ͯ͠࿩͠·͢ 9
  3. ΞΧ΢ϯτͷ౷߹ʹඞཁͳ͜ͱ ID ج൫ͱ͍͏γεςϜΛ࡞Δ • ։ൃνʔϜ͕ൃ଍ • Go + Next.js ੡

    • ຊൃදͷର৅֎ ! طଘαʔϏεʹ ID ج൫Λಋೖ͢Δ • ࠷ॳͷಋೖઌ͸ɺωοτγϣοϓ ࡞੒αʔϏεͷ STORES • Rails + Nuxt.js ੡ • զʑ͕୲౰ • 3 ਓνʔϜ w/ @HolyGrail, ۀ຿ҕୗͷํ • ຊൃදͰѻ͏಺༰ 11
  4. STORES ΁ͷ ID ج൫ͷಋೖํ਑ • ೝূํࣜͷ௥ՃͰ͸ͳ͘ɺΞΧ΢ϯτҠߦ͠ೝূํࣜΛ੾Γସ͑ Δ • ࠷ॳͷಋೖͳͷͰɺ৽͍͠ೝূํࣜͷૌٻ͸೉͍͠ •

    ͨͱ͑͹ʮSTORES ϓϥοτϑΥʔϜͰϩάΠϯʯ͸ࠞཚͷ΋ ͱ • ΞΧ΢ϯτҠߦͷͨΊʹϢʔβʔૢ࡞ΛٻΊͳ͍ • ཪଆͰ͍͍ײ͡ʹɺͰ͖Ε͹μ΢ϯλΠϜͳ͠Ͱ҆શʹ੾ΓସΘΔ 12
  5. ϓϩτίϧ • OpenID Connect (OIDC)1 ४ڌ • OAuth 2.0 ্ʹ৐͔ͬͬͨγϯϓϧͳΞΠσϯςΟςΟϨ

    ΠϠʔ • ID ࿈ܞΛ͍͍ײ͢͡Δϓϩτίϧ • omniauth_openid_connect gem Λར༻ 1 https://openid.net/connect/ 14
  6. ભҠઌ΍ϦμΠϨΫγϣϯͷ੾Γସ͑ • Feature Toggle + τϥϯΫϕʔε։ൃ • ! • վमൣғ͕޿ͯ͘΋ڝ߹ͷϦεΫ͕௿

    ͍ • ৽͍͠γεςϜΛฒߦͯ͠࡞Γͳ͕ Βɺஈ֊తʹಋೖͷ४උ͕Մೳ • ϩʔϧόοΫ͕༰қ (σʔλΛআ͍ͯ) 16
  7. 19

  8. 20

  9. 21

  10. 22

  11. ೝূೝՄྖҬͷֶश ϦϞʔτษڧձΛ։࠵ • OAuth 2.1 RFC ΛಡΉձ • OpenID Foundation

    Japan ͷΤόϯδΣϦετͷํʑʹ૬ஊ͢Δձ2 ޮՌ • ਖ਼֬ͳཧղͷଅਐɺෆ҆ཁૉͷղফɺΑΓΑ͍ํ๏΁ͷؾ෇͖ • ϝϯόʔͷೝࣝΛ߹Θͤͯڞ௨ݴޠΛ֫ಘ 2 https://www.openid.or.jp/blog/cat170/ 24
  12. ։ൃ؀ڥͷ੔උ • ID ج൫ͱ STORES ͸ͦΕͧΕ docker compose Ͱ։ൃ؀ڥΛߏங •

    ઃఆʹ݁߹఺Λ࡞Γͨ͘ͳ͍ʢΤϯυϙΠ ϯτࢦఆɺϙʔτ൪߸ॏෳճආͳͲʣ • => STORES ͔Β ID ج൫Λ Docker in Docker3 (dind) Ͱىಈ • ࿈ܞ͕ෆཁͳͱ͖͸ೝূϞοΫͰܰྔԽ • ಉظपΓͷ SNS, SQS ͸ localstack Ͱ ϞοΫ 3 https://hub.docker.com/_/docker 25
  13. ۤ࿑ͨ͜͠ͱ αʔϏεݸผͷࣄ৘ vs ڞ௨ج൫ͷීวੑ • ࠷ॳͷ࿈ܞαʔϏεͱͯ͠ɺࣗવͳϢʔβʔମݧΛఏڙͨ͠ ͍ • Ұ࣌తʹ ID

    ج൫ͱ STORES Ͱີ݁߹ʹͳΔ෦෼͕ੜ͡Δ • ؾ࣋ͪѱ͍͕ɺ୹ظతͳ໨తͷͨΊʹҰఆ͸ڐ༰͠ɺ࣍ͷऔ Γ૊ΈͰղফΛܭը • ID ج൫ʹෛ࠴Λ๊͑ͯ΋Β͍ͬͯΔঢ়گ 31
  14. ֶͼ ن֨ʹ৐Δͱ҆શͰޮ཰͕ྑ͍ • ڞ௨ج൫ͷϓϩτίϧ࡞Γ͸ͱͯ΋೉͍͠໰୊ • OIDC ͷ͓͔͛Ͱզʑ͸Ͳ͏࣮૷͢Δͷ͔ͱ͍͏ݕ౼ʹ஫ྗͰ͖ͨ • طଘͷن͕֨͋Γɺ໨తʹ߹க͍ͯ͠ΔͳΒɺ࢖Θͳ͍ख͸ͳ͍ •

    ଟ͘ͷٞ࿦͕ॏͶΒΕར༻࣮੷ͷ͋Δن֨ΑΓ༏Εͨ΋ͷΛ࡞Δͷ͸೉͠ ͍ • ϥΠϒϥϦ͕ଘࡏ͢Δ͜ͱ΋ଟ͍ • RFC ΛͪΌΜͱಡΜͰ࢓૊ΈΛཧղ͢Δͷ͸ॏཁ 37
  15. ·ͱΊ • ID ج൫ͷ STORES ΁ͷಋೖͱΞΧ΢ϯτͷҠߦΛɺμ΢ϯλΠϜͳ ͠ɺϢʔβʔૢ࡞ෆཁͰߦͬͨࣄྫΛ঺հͨ͠ • औΓ૊ΈͷதͰۤ࿑ͨ͜͠ͱ΍ಘΒΕֶͨͼΛ঺հͨ͠ɻಛʹɺજΜ Ͱ͍ͨ໰୊΁ͷऔΓ૊Έʹ͍͓ͭͯ࿩ͨ͠͠

    • ෳࡶͳ໰୊͕ଓʑͱग़ͯ͘Δͱࠞཚ͢Δ͜ͱ΋͋Δ͕ɺ໨తʹूத͠ ͯγϯϓϧʹղ͘ɺͱ͍͏ͷΛ๨Εͣʹ͍͍ͨ • γεςϜҠߦ΍෼ׂͱ͍ͬͨಉछͷ໰୊΍ɺଞͷ೉͍͠໰୊ʹऔΓ૊ ·ΕΔํͷώϯτʹͳΔͱ͏Ε͍͠ 39
  16. 40