Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Sorcery Gem
Search
ebi
November 07, 2016
Technology
1
570
Sorcery Gem
Presentation about sorcery gem.
ebi
November 07, 2016
Tweet
Share
More Decks by ebi
See All by ebi
Sorcery Internal Structure
ebihara99999
3
120
Other Decks in Technology
See All in Technology
サーバーサイドのデータプレーンプログラミング 〜 NVIDIA Blue Field / DOCA 〜
ebiken
PRO
1
230
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
230
DFTの実践的基礎理論
pfn
PRO
2
100
分布で見る効果検証入門 / ai-distributional-effect
cyberagentdevelopers
PRO
2
550
Kubernetes Summit 2024 Keynote:104 在 GitOps 大規模實踐中的甜蜜與苦澀
yaosiang
0
270
ABEMA のコンテンツ制作を最適化!生成 AI x クラウド映像編集システム / abema-ai-editor
cyberagentdevelopers
PRO
1
130
初心者に Vue.js を 教えるには
tsukuha
3
210
Emacs x Nostr
hakkadaikon
1
120
端末が簡単にリモートから操作されるデモを通じて ソフトウェアサプライチェーン攻撃対策の重要性を理解しよう
kitaji0306
0
150
バクラクにおける可観測性向上の取り組み
yuu26
2
230
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
190
サイロ化した金融システムを、packwerk を利用して無事故でリファクタリングした話
coincheck_recruit
3
3.2k
Featured
See All Featured
The Invisible Side of Design
smashingmag
297
50k
For a Future-Friendly Web
brad_frost
174
9.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
Code Reviewing Like a Champion
maltzj
519
39k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
Designing for humans not robots
tammielis
249
25k
Gamification - CAS2011
davidbonilla
80
5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
10 Git Anti Patterns You Should be Aware of
lemiorhan
653
59k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
RailsConf 2023
tenderlove
29
870
Transcript
Sorcery Gem @ebihara99999
ࣗݾհ • LICTOORגࣜձࣾͱ͍͏ελʔτΞοϓۈɻ • ΫϩʔϥʔΛΑ͘ॻ͍͍ͯ·͢ɻ • ਓ͕গͳ͍ͷͰΠϯϑϥߏஙʢओʹ"84ʣ͔Β ϑϩϯτΤϯυ·Ͱ৭ʑ৮͍ͬͯ·͢ɻ
Sorceryͱ • ೝূػೳΛఏڙ͢Δ gem • ActiveRecordɾDataMapperɾMongoidɾ MongoMapperΛαϙʔτ • ઃఆϑΝΠϧ config/initializers/sorcery.rb
ͷΈ • ॕʂ organizationԽ
Installation • جຊܗ $ rails generate sorcery:install app/models/user.rb db/migrate/***_sorcery_core.rb config/initializers/sorcery.rb
• ࡞͞ΕΔϑΝΠϧ
# 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
Installation • ػೳʢޙड़ʣΛՃ͍ͨ͠߹ $ rails generate sorcery:install external --only-submodules •
ModelΛมߋ͍ͨ͠߹ $ rails generate sorcery:install --model Person
ೝূʹ༻͢ΔΧϥϜͷมߋ • σϑΥϧτFNBJMͱDSZQUFE@QBTTXPSE • migrationϑΝΠϧͱconfig/initializers/sorcery.rbΛฤू ʢҎԼemailͱusernameΛೝূʹ͏߹ʣ # config/initializers/sorcery.rb user.username_attribute_names =
[:email, :username] /* log */ SELECT `users`.* FROM `users` WHERE (`users`.`username` = '
[email protected]
' OR `users`.`email` = '
[email protected]
') ORDER BY `users`.`id` ASC LIMIT 1
ෳϞσϧରԠ • STIରԠ • config/initializers/sorcery.rbΛฤू # config/initializers/sorcery.rb user.subclasses_inherit_config = true
• ͦͷޙɺ45*Λ࣮͢Δ • ৄ͘͠චऀ࡞ͷαϯϓϧΞϓϦΛ͝ཡ͍ͩ͘͞ʢhttps:// github.com/ebihara99999/sorcery-presentation-app/tree/ presentationʣ
ෳϞσϧରԠ • STIͰରԠͰ͖ͳ͍ʢ͠ͳ͍ʣ߹ɺSorceryͱͯ͠ఏڙ͢Δศརػೳ ͳ͠ • ཁ͕݅ෳࡶͳ߹ɺࣗͰΧελϚΠζ͢Δඞཁ͕͋Δ • adminͱuser͕͍Δ߹ɺrails generate sorcery:install
--model AdminΛͯ͠ɺadminϞσϧ࡞͠ɺཁ݅ʹԠͯ͡migrationϑΝΠ ϧΛमਖ਼͢Δ • adminͱuserΛඥ͚͍ͨ߹ɺuserϞσϧʹadmin_idΛ࣋ͬͨΓɺ admin_usersςʔϒϧʢதؒςʔϒϧʣΛ࡞ͨ͠Γ͢Δ • ൺֱతΧελϚΠζ͠қ͍͠ɺTPSDFSZͷBQJ͑ΔͷͰศར
ϞδϡʔϧҰཡ • ػೳ͝ͱͰ module ʹׂ͞Ε͍ͯΔ Core / User Activation /
Reset Password / Remember Me / Session Timeout / Brute Force Protection / Basic HTTP Authentication / Activity Logging / External
֤Ϟδϡʔϧͷઆ໌ • Core • جຊػೳͷఏڙ • ιϧτͷઃఆɾՃՄೳ • Ϣʔβʔ໊ɾFNBJMɾύεϫʔυଐੑͷ໊শΛมߋՄೳ •
User Activation • ϝʔϧೝূʢೝূϝʔϧΛૹ৴͠ϦϯΫΛ౿ΜͰΒ͏ʣ • Reset Password • ύεϫʔυϦηοτ
֤Ϟδϡʔϧͷઆ໌ • Remember Me • ࣗಈϩάΠϯ • Session Timeout •
ઃఆϑΝΠϧͷΈͰઃఆՄ • Brute Force Protection • ύεϫʔυ߈ܸͷରԠɻ • ϩοΫ·ͰͷࣦഊճɾϩοΫ࣌ؒΛઃఆՄɻ
֤Ϟδϡʔϧͷઆ໌ • Basic HTTP Authentication • Basicೝূ • Activity Logging
• ࠷ऴϩάΠϯ࣌ • ࠷ऴϩάΞτ࣌ • ࠷ऴΞΫςΟϏςΟ࣌ • ࠷ऴϩάΠϯ࣌ͷ*1
• External • ֎෦αʔϏεϩάΠϯ ରԠαʔϏε Twitter / Facebook / Github
/ Google / Heroku / LinkedIn / VKʢϩγΞ࠷େͷSNSʣ / LiveID / XingʢυΠπͷLinkedInͷΑ͏ͳSNSʣ / Salesforce / JIRA / PayPal / slack
࠷ޙʹ • wikiʹ֤Ϟδϡʔϧͷ࣮ํ๏͕ஸೡʹॻ͍ͯ͋Δ ͷͰɺੋඇҰ৮ͬͯΈ͍ͯͩ͘͞ɻ • ࡞ऀʹΑΔαϯϓϧΞϓϦެ։͞Ε͍ͯ·͢ɻ https://github.com/Sorcery/sorcery-example- app • NoamB/sorcery
Ͱͳ͘ Sorcery/sorcery ͳͷͰ ͝ҙ͍ͩ͘͞ɻ
ࢀߟ • https://github.com/Sorcery/sorcery • https://github.com/Sorcery/sorcery/wiki