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

Cognito User Poolsと仲良くなるための話 / cognito-user-pools

Cognito User Poolsと仲良くなるための話 / cognito-user-pools

Cognitoと仲良くなるためにAmplifyはいいぞ!という話をしました。

Takahiro Tsuchiya

May 28, 2019
Tweet

More Decks by Takahiro Tsuchiya

Other Decks in Programming

Transcript

  1. $PHOJUP6TFS1PPMT
    ͱ஥ྑ͘ͳΔͨΊͷ࿩
    +"846(໊ݹ԰ೝূษڧձ
    ʢՐʣ
    5BLBIJSP5TVDIJZB!DPSPDO

    View full-size slide

  2. 5BLBIJSP5TVDIJZB
    ͜ΖͪΌΜ
    !DPSPDO


    $PEF਌ࢠ%FW0QTܥαʔϏε͕޷͖Ͱ͢

    View full-size slide

  3. ࣗݾ঺հ
    w ذෞݝࡏॅͷϑϧϦϞʔτϫʔΧʔ
    w גࣜձࣾΩϟελʔͰCPTZVΛ։ൃ
    w 3VCZPO3BJMTɺ7VFKTɺ"84ɺೝূٕज़
    w ίϛϡχςΟɾษڧձొஃ
    w /BHPZB'SPOUFOE6TFS(SPVQ
    w +"846(໊ݹ԰
    w "VUI"NCBTTBEPS$PNNVOJUZ-FBEFST
    w *EFOUJUZ%BODF4DIPPMʢٕज़ॻయͷ࿩ʣ
    w ໊ݹ԰3VCZձٞʢύεϫʔυϨεೝূͷ࿩ʣ

    View full-size slide

  4. $PHOJUPͱͷग़ձ͍
    w αʔϏε։ൃͰαοͱ࢖͑Δ*%BB4Λ୳͍ͯͨ͠
    w "NQMJGZ͕ൃද͞Εͨ͜Ζʢޙ൒ʁʣ
    w ͪΐΖͬͱΞΫηε੍ޚ͔͚ͨͬͨͩ͠
    w ߏ੒ෳࡶͰཧղͰ͖ͣϋʔυϧ͕ߴͯ͘࠳ં
    w ͦͷޙ"VUIʹग़ձ͏
    w "VUIʹࠢΛചΔ
    w ຊۀҎ֎Ͱ$PHOJUP࢖͏ػձ͕ʂ ?P?

    View full-size slide

  5. $PHOJUP

    ׬શʹཧղͨ͠

    View full-size slide

  6. IUUQTUPHFUUFSDPNMJ

    View full-size slide

  7. ΋ͬͱৄ͘͠ͳΓ͍ͨʂ

    View full-size slide

  8. ࠓ೔ͷ࿩
    w 8FCΞϓϦ։ൃͷίϯςΩετߴΊ
    w "DUJWF%JSFDUPSZͷ࿩͸͠·ͤΜ
    w $PHOJUPͷػೳΛ੔ཧ
    w "NQMJGZͱҰॹʹ࢖͏ͱ஥ྑ͘ͳΕͦ͏
    w ஥ྑ͘ͳΔͨΊͷπʔϧ঺հ
    w ࣌ؒ͋Ε͹5JQTͱ͔

    View full-size slide

  9. $PHOJUPͷػೳ
    w "84͕ఏڙ͢ΔೝূೝՄαʔϏε
    w $PHOJUP'FEFSBUFE*EFOUJUZʢ*%ϓʔϧʣ
    w *E1ʢ*EFOUJUZ1SPWJEFSʣʹରͯ͠454Λ෷͍ग़͢
    w *E1'BDFCPPL (PPHMF $PHOJUP6TFS1PPMTͳͲ
    w $PHOJUP6TFS1PPMTʢϢʔβʔϓʔϧʣ
    w "84͕ఏڙ͢Δ*E1ɺϢʔβʔొ࿥ɾೝূɾ؅ཧ
    w ֎෦*E1ͱಉྻػೳʹҐஔ͢Δ
    w $PHOJUP4ZOD
    w σʔλͷσόΠεؒಉظ

    View full-size slide

  10. https://docs.aws.amazon.com/ja_jp/cognito/latest/
    developerguide/cognito-scenarios.html

    View full-size slide

  11. ೝূํࣜ
    w 431ʢ4FDVSF3FNPUF1BTTXPSEʣ
    w ΫϥΠΞϯτͱ$PHOJUP͕௚઀௨৴͢Δ
    w ωοτϫʔΫܦ༝Ͱύεϫʔυ͕ૹ৴͞Εͳ
    ͍


    View full-size slide

  12. ΞϓϦΫϥΠΞϯτઃఆ
    w ΫϥΠΞϯτೝূͷ৔߹͸ʜ

    ˠγʔΫϨοτ͸ෆཁͳͷͰੜ੒ͪ͠ΌͩΊ

    View full-size slide

  13. 0"VUI
    w 1,$&ʢ1SPPG,FZGPS$PEF&YDIBOHFCZ0"VUI1VCMJD$MJFOUTʣ
    ʹະର
    ԠͳͷͰϞόΠϧΞϓϦೝূͩͱݫ͍͠
    w *NQMJDJUHSBOU͸ઈର࢖Θͳ͍ʢ੬ऑʣ
    w 431Ͱ֤छτʔΫϯ͕औಘͰ͖ΔͷͰ͋͑ͯ0"VUI
    ࢖͏ඞཁͳͦ͞͏

    View full-size slide

  14. ͦͷଞͷϢʔεέʔε
    w αʔόʔϕʔεͰೝূ͍ͨ͠
    w "%.*/@/0@431@"65)
    w ΧελϜೝূ࢖͍͍ͨʢ-BNCEBʣ
    w $6450.@"65)@'-08@0/-:
    w ϢʔβʔҠߦ͍ͨ͠
    w 64&3@1"44803%@"65)

    View full-size slide

  15. ݁ہͲΕ࢖͑͹͍͍ͷʁ
    w 8FCϞόΠϧΞϓϦͰαʔόʔϨε͍ͨ͠
    w 431ͰΫϥΠΞϯτೝূҰ୒
    w ఻౷తͳαʔόʔ͋Γͷ8FCγεςϜ
    w ϩάΠϯΤϯυϙΠϯτ࣮૷ͯ͠αʔόʔϕʔεೝূ
    w MPHJO΁Ϣʔβʔ໊ͱύεϫʔυ౤͛Δ
    w αʔόʔܦ༝Ͱ"ENJO*OJUJBUF"VUI"1*Λୟ͍ͯೝূͯ͠
    ηογϣϯΛཱ֬͢ΔΑ͏ͳύλʔϯ͸ͬͪ͜
    w $PHOJUPͷྑ͕ࣦ͞ΘΕΔͷͰ͸ײ͕एׯ

    View full-size slide

  16. "NQMJGZ
    w $PHOJUPͷ+BWB4DSJQU4%,Λ௚઀ѻ͏ͱ
    ΞϓϦଆͷ࣮૷͕एׯ໘౗
    w 6*΋ࣗ෼Ͱ࡞Βͳ͖Ό͍͚ͳ͍
    w "NQMJGZͷϨʔϧʹ৐Δ͜ͱͰඇৗʹ؆୯ʹ
    ೝূը໘ΛߏஙͰ͖Δ
    w 5ZQF4DSJQUରԠࡁ
    w ஥ྑ͘ͳΕͦ͏ͳ༧ײ

    View full-size slide

  17. "NQMJGZͬͯԿ͚ͩͬ
    w 8FCʢ41"ʣϞόΠϧΞϓϦΛߴ଎ʹߏங͢ΔͨΊͷπʔϧ܈
    w "NQMJGZKT.PCJMF༻4%,ɹˡࠓճ͸γϯϓϧʹ͚ͩ͜͜࢖͏
    w ΫϥΠΞϯτ૊ΈࠐΈ༻ϥΠϒϥϦ
    w "NQMJGZ$-*
    w ίϚϯυϥΠϯܦ༝Ͱ"84ͷ֤छαʔϏεͷઃఆ͕Ͱ͖Δ
    w $MPVE'PSNBUJPOΛར༻͍ͯ͠Δ
    w "NQMJGZ$POTPMF
    w (JUͷมߋΛτϦΨʔͱͨ͠੩తαΠτͷര଎ެ։αʔϏε
    w /FUMJGZͷ"84൛ɺ(JU-BCରԠͳͲɺ୺຤͝ͱͷදࣔνΣοΫ
    w ೝূ͚ͩͰͳͯ͘4΍"QQ4ZODͳͲɺαʔόʔϨεͰҰ௨Γಈ͘ΞϓϦΛ࡞
    ΔͨΊͷ؀ڥͰɺ(PPHMFͷ'JSFCBTFΛҙ͍ࣝͯ͠Δɻ

    View full-size slide

  18. BNB[PODPHOJUPJEFOUJUZKT
    w $PHOJUPͷ+BWB4DSJQU4%,͸"NQMJGZKTͷ
    ϦϙδτϦ഑ԼʹҠಈͨ͠
    w "84ʮΫϥΠΞϯταΠυ͸"NQMJGZ࢖ͬͯͶʯ

    View full-size slide

  19. "NQMJGZೝূΛ஌Δ
    w IUUQTBXTBNQMJGZHJUIVCJPEPDT
    KTBVUIFOUJDBUJPO͕ࢀߟʹͳΔ
    w ೝূʹؔ͢Δ৘ใ͕ඇৗʹॆ࣮͍ͯ͠Δ
    w "NQMJGZ"VUI͕෼͔Ε͹ྑͦ͞͏





    View full-size slide

  20. "NQMJGZ$PHOJUPͷ͍͍ͱ͜Ζ
    w 3FBDU 7VF "OHVMBSͰ࢖͑Δ6*෇͖ೝূϥΠϒϥ
    Ϧ͕ఏڙ͞Ε͍ͯΔ
    w ೝূ࣌ʹඞཁͳը໘͕Ұ௨Γ໢ཏ͞Ε࣮ͯ૷͞Ε͍ͯΔ
    w 4JHO*O $POpSN4JHO*O 4JHO6Q
    $POpSN4JHO6Q 'PSHPU1BTTXPSE
    w ͍ͭ͜Λ૊ΈࠐΊ͹ҰॠͰ࣮૷͕ऴΘΔ
    w BNQMJGZBVUIFOUJDBUPSλάΛஔ͚ͩ͘
    w $PHOJUP࢖ͬͨϓϩτλΠϓ։ൃͱ͔ϝονϟૣ͍ͱࢥ͏

    View full-size slide

  21. ݸਓతʹخ͍͠ͱࢥͬͨϙΠϯτʢ7VFKTʣ
    w &WFOU#VTʹରԠ͍ͯ͠ΔͷͰը໘ભҠͷ੍
    ޚ͕ඇৗʹָ
    w Ϣʔβʔొ࿥ˠݕূίʔυೖྗͳͲͷը໘ભ
    Ҡͱ41"ͷϧʔςΟϯάܨ͗ࠐΈ͕͍͍ײ͡
    ʹ੍ޚͰ͖Δ
    w ΧελϜσβΠϯʹ΋ରԠ͍ͯ͠Δ
    w ͔ͳΓυΩϡϝϯτஸೡ

    View full-size slide

  22. "NQMJGZܦ༝ͰऔಘͰ͖ΔτʔΫϯ
    w "NQMJGZͰೝূΛ͢Δͱෳ਺ͷτʔΫϯΛऔಘͰ͖Δ
    w ೝূޙMPDBM4UPSBHFʹࣗಈͰ֨ೲ͞ΕΔʢʂʣ
    w JE5PLFOʢೝূτʔΫϯʣ
    w ࣗલͷ"1*αʔόʔΛೝূͨ͠ΓɺΧελϜΦʔιϥΠβʔ࢖͏৔߹
    w BDDFTT5PLFOʢೝՄτʔΫϯʣ
    w *EFOUJUZ1PPMT΁ͷΞΫηεͯ͠454Λ෷͍ग़ͨ͢Ί
    w SFGSFTI5PLFO
    w τʔΫϯߋ৽༻ʢBDDFTTʣ

    View full-size slide

  23. https://docs.aws.amazon.com/ja_jp/cognito/latest/
    developerguide/cognito-scenarios.html

    View full-size slide

  24. τʔΫϯ͸+85ܗࣜ
    w FZ+Ͱ࢝·ΔτʔΫϯ͸+40/8FC5PLFO
    w +40/Λ#BTFΤϯίʔυͯ͠࿈݁ͨ͠΋ͷ
    w IFBEFSQBZMPBETJHOBUVSF
    w QBZMPBE෦෼ʹϢʔβʔ৘ใ͕֨ೲ͞Ε͍ͯΔ
    w ॺ໊͕͋ΔͷͰվ͟Μͷ֬ೝ͕Ͱ͖Δ
    w IUUQTKXUJPʹషΓ෇͚Δͱத਎͕ݟ͑Δ
    w FZ+Λݟ͚ͭͨΒͥͻ೷͍ͯΈ·͠ΐ͏
    w SFGSFTI5PLFO͸҉߸Խ͞Εͯͯதݟ͑ͳ͔ͬͨ

    View full-size slide

  25. τʔΫϯͷܗࣜ͸+85
    w FZ+Ͱ࢝·ΔτʔΫϯ͸σίʔυͰ͖Δ
    w KXUJPͳͲͰ
    TVC͕DPHOJUPͷ66*%

    View full-size slide

  26. ϩάΠϯঢ়ଶͷ൑ఆ
    w ΞϓϦଆͰϩάΠϯͯ͠Δ͔൑ఆ͍ͨ͠৔߹
    w ϩάΠϯத༗ޮͳτʔΫϯΛอ༗͍ͯ͠Δ
    w ΫϥΠΞϯτ͔͠஌Γ͑ͳ͍
    w "VUIDVSSFOU4FTTJPO
    Ͱ൑ఆ͢Δ

    View full-size slide

  27. ࣗલαʔόʔͷೝূʹ࢖͏
    $PHOJUP͔Βൃߦ
    ͞Ε͍ͯΔެ։伴Ͱ+85
    ͷॺ໊Λݕূ
    ֨ೲ৔ॴ͸ཁݕ౼

    ݱঢ়MPDBM4UPSBHF͸ةͳ͍ͷͰ
    IUUQ0OMZͳTFTTJPO͕ϕλʔ

    View full-size slide

  28. +40/8FC,FZ
    w IUUQTDPHOJUPJEQBQOPSUIFBTUBNB[POBXTDPNBQ
    OPSUIFBTU@999999999XFMMLOPXOKXLTKTPO͔Β+85Λݕ
    ূ͢ΔͨΊͷެ։ݤ͕औಘͰ͖Δʢ99999͸6TFS1PPM*Eʣ
    w +85ͷIFBEFSͷLJEͱରԠ͠
    ͯΔ伴Λ࢖͏

    View full-size slide

  29. $PHOJUP7JFXFS
    w ݕূਐ·ͳ͍ˠ֬ೝπʔϧ࡞ͬͨ
    w ໭Γ஋ͱ͔τʔΫϯͷத਎Λ֬ೝ͢Δͷ໘౗
    w ΫϥΠΞϯτଆ͕ͳ͍ͱಈ͖෼͔ΒΜ
    w ઃఆ͕ؒҧͬͯΔͷ͔࣮૷͕ؒҧͬͯΔͷ͔
    w ϢʔβʔμογϡϘʔυͱ"EN*OJUJBUF"VUIͰ࡞ͬͨ
    ϢʔβʔΛೝূࡁΈʹ͢ΔػೳΛ͚͍ͭͨ
    w IUUQTHJUIVCDPNDPSPDODPHOJUPWJFXFS
    w ˞ಈ͔ͨ͢Ίʹ*EFOUJUZ1PPMͷ࡞੒΋ඞཁ

    View full-size slide

  30. %&.0
    ʢ࣌ؒͳ͚Ε͹࠷ޙͰʣ

    View full-size slide

  31. "NQMJGZͰ஫ҙ͍ͨ͠ͱ͜Ζ
    w τʔΫϯͷ༗ޮظݶΛࢦఆͰ͖ͳ͍
    w τʔΫϯͷอଘઌ͕MPDBM4UPSBHF
    w τʔΫϯͷߋ৽Λ੍ޚͰ͖ͳ͍ʢࣗಈߋ৽ʣ

    View full-size slide

  32. τʔΫϯͷ༗ޮظݶΛࢦఆͰ͖ͳ͍
    w JE5PLFONJO
    w BDDFTT5PLFONJO
    w SFGSFTI5PLFOEBZT
    w τʔΫϯ͕࿙Εͨ࣌Λߟྀͯ͠ՄೳͳݶΓ୹͍
    ࣌ؒʹઃఆ͍ͨ͠
    w ͦ΋ͦ΋JE BDDFTT5PLFO͸࿙ΕΔલఏͰ
    ઃܭ͢Δඞཁ͕͋Δ

    View full-size slide

  33. τʔΫϯͷอଘઌ͕MPDBM4UPSBHF
    w BDDFTT5PLFO͸·ͩ͠΋SFGSFTI5PLFOͷΑ͏ͳੜଘظ͕ؒ௕
    ͍τʔΫϯΛϒϥ΢βʹอଘͯ͠͠·͍ͬͯΔ
    w 944ͰͿͬ͜ൈ͔ΕΔͷͰɺ֎෦+4ಡΉ࣌஫ҙɻಛʹ޿ࠂͱ͔ɻ
    w IUUQ0OMZDPPLJF͸ະαϙʔτ
    w IUUQTHJUIVCDPNBXTBNQMJGZBNQMJGZKT
    JTTVFT
    w ϞόΠϧͱҟͳΓɺ8FC͸ηΩϡΞʹอଘͰ͖Δ৔ॴ͕ͳ͍
    w ϒϥ΢βʹอଘͤͣJONFNPSZͰ΍Γ͍ͨ
    w $PHOJUPͱηογϣϯషΕΔػೳ͕͜ͳ͍ͱ೉ͦ͠͏

    View full-size slide

  34. τʔΫϯͷߋ৽Λ੍ޚͰ͖ͳ͍
    w τʔΫϯͷ༗ޮظݶ͕੾ΕͨޙͷॳճΞΫηεͰࣗಈͰ৽͍͠
    τʔΫϯʹߋ৽͞ΕΔ
    w خ͍͠൒໘ɾɾɾ
    w ΫϥΠΞϯτͰτʔΫϯͷ༗ޮظݶ0,ˠϦΫΤετ࣌ࠩͰ
    αʔόʔଆݕূ࣌ʹ༗ޮظݶ/(ͷ৔߹͕ൃੜ͢Δ
    w ΫϥΠΞϯτଆͰૣΊʹτʔΫϯΛߋ৽͓͖͍ͯͨ͠PSαʔ
    όʔଆͰ༗ޮظݶͷΏͱΓʢMFFXBZʣΛ΋ͨͤΔඞཁ͕ͰΔ
    w αʔόʔଆʹΏͱΓΛ΋ͨͤΔͷਪ঑Β͍͠
    w ʢͲ͔͜ͷJTTVFͰٞ࿦͞Ε͚ͯͨͲݟ͔ͭΒͳ͍ʣ

    View full-size slide

  35. ॅΈ෼͚େࣄ
    w "84ͰαʔόʔϨε

    ˠ$PHOJUP"NQMJGZ
    w ($1ͰαʔόʔϨε

    ˠ'JSFCBTF
    w αʔόʔ͕͋ΔηΩϡϦςΟཁ݅ݫ͍͠

    ˠ"VUI

    View full-size slide

  36. ·ͱΊ
    w 8FCΞϓϦ։ൃͰͷೝূͷ࿩Λͨ͠
    w "NQMJGZ࢖͏ͱ$PHOJUPͱ஥ྑ͘ͳΕ·͢
    w +85࢖ͬͨೝূͷ࢓૊ΈΛ཈͓͑ͯ͘͜ͱ
    w ηΩϡϦςΟपΓͷཁ݅஫ҙʢಛʹ8FCʣ
    w "84ͷαʔϏεʹݻࣥͤͣॊೈͳબ୒Λ
    w ࠓޙͷΞοϓσʔτͰԽ͚ͦ͏

    View full-size slide