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
610
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
130
Other Decks in Technology
See All in Technology
機械学習を扱うプラットフォーム開発と運用事例
lycorptech_jp
PRO
0
610
プラットフォーム転換期におけるGitHub Copilot活用〜Coding agentがそれを加速するか〜 / Leveraging GitHub Copilot During Platform Transition Periods
aeonpeople
1
230
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
22
12k
初めてAWSを使うときのセキュリティ覚書〜初心者支部編〜
cmusudakeisuke
1
280
JTCにおける内製×スクラム開発への挑戦〜内製化率95%達成の舞台裏/JTC's challenge of in-house development with Scrum
aeonpeople
0
250
開発者を支える Internal Developer Portal のイマとコレカラ / To-day and To-morrow of Internal Developer Portals: Supporting Developers
aoto
PRO
1
480
いま注目のAIエージェントを作ってみよう
supermarimobros
0
350
スマートファクトリーの第一歩 〜AWSマネージドサービスで 実現する予知保全と生成AI活用まで
ganota
2
310
[ JAWS-UG 東京 CommunityBuilders Night #2 ]SlackとAmazon Q Developerで 運用効率化を模索する
sh_fk2
3
460
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/06 - 2025/08
oracle4engineer
PRO
0
110
MagicPod導入から半年、オープンロジQAチームで実際にやったこと
tjoko
0
110
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
130
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
We Have a Design System, Now What?
morganepeng
53
7.8k
Why Our Code Smells
bkeepers
PRO
339
57k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
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