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

Sorcery Gem

ebi
November 07, 2016

Sorcery Gem

Presentation about sorcery gem.

ebi

November 07, 2016
Tweet

More Decks by ebi

Other Decks in Technology

Transcript

  1. # db/migrate/20161024063842_sorcery_core.rb class SorceryCore < ActiveRecord::Migration def change create_table :users

    do |t| t.string :email, :null => false t.string :crypted_password t.string :salt t.timestamps end add_index :users, :email, unique: true end end
  2. ෳ਺ϞσϧରԠ • STIରԠ • config/initializers/sorcery.rbΛฤू # config/initializers/sorcery.rb user.subclasses_inherit_config = true

    • ͦͷޙɺ45*Λ࣮૷͢Δ • ৄ͘͠͸චऀ࡞੒ͷαϯϓϧΞϓϦΛ͝ཡ͍ͩ͘͞ʢhttps:// github.com/ebihara99999/sorcery-presentation-app/tree/ presentationʣ
  3. ෳ਺ϞσϧରԠ • STIͰରԠͰ͖ͳ͍ʢ͠ͳ͍ʣ৔߹ɺSorceryͱͯ͠ఏڙ͢Δศརػೳ͸ ͳ͠ • ཁ͕݅ෳࡶͳ৔߹͸ɺࣗ෼ͰΧελϚΠζ͢Δඞཁ͕͋Δ • adminͱuser͕͍Δ৔߹ɺrails generate sorcery:install

    --model AdminΛͯ͠ɺadminϞσϧ΋࡞੒͠ɺཁ݅ʹԠͯ͡migrationϑΝΠ ϧΛमਖ਼͢Δ • adminͱuserΛඥ෇͚͍ͨ৔߹ɺuserϞσϧʹadmin_idΛ࣋ͬͨΓɺ admin_usersςʔϒϧʢதؒςʔϒϧʣΛ࡞੒ͨ͠Γ͢Δ • ൺֱతΧελϚΠζ͠қ͍͠ɺTPSDFSZͷBQJ͸࢖͑ΔͷͰศར
  4. ϞδϡʔϧҰཡ • ػೳ͝ͱͰ module ʹ෼ׂ͞Ε͍ͯΔ Core / User Activation /

    Reset Password / Remember Me / Session Timeout / Brute Force Protection / Basic HTTP Authentication / Activity Logging / External
  5. ֤Ϟδϡʔϧͷઆ໌ • Core • جຊػೳͷఏڙ • ιϧτͷઃఆɾ௥ՃՄೳ • Ϣʔβʔ໊ɾFNBJMɾύεϫʔυଐੑͷ໊শΛมߋՄೳ •

    User Activation • ϝʔϧೝূʢೝূϝʔϧΛૹ৴͠ϦϯΫΛ౿ΜͰ΋Β͏ʣ • Reset Password • ύεϫʔυϦηοτ
  6. ֤Ϟδϡʔϧͷઆ໌ • Remember Me • ࣗಈϩάΠϯ • Session Timeout •

    ઃఆϑΝΠϧͷΈͰઃఆՄ • Brute Force Protection • ύεϫʔυ߈ܸ΁ͷରԠɻ • ϩοΫ·Ͱͷࣦഊճ਺ɾϩοΫ࣌ؒΛઃఆՄɻ
  7. ֤Ϟδϡʔϧͷઆ໌ • Basic HTTP Authentication • Basicೝূ • Activity Logging

    • ࠷ऴϩάΠϯ೔࣌ • ࠷ऴϩάΞ΢τ೔࣌ • ࠷ऴΞΫςΟϏςΟ೔࣌ • ࠷ऴϩάΠϯ࣌ͷ*1
  8. • External • ֎෦αʔϏεϩάΠϯ ରԠαʔϏε Twitter / Facebook / Github

    / Google / Heroku / LinkedIn / VKʢϩγΞ࠷େͷSNSʣ / LiveID / XingʢυΠπͷLinkedInͷΑ͏ͳSNSʣ / Salesforce / JIRA / PayPal / slack