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
600
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
A2Aのクライアントを自作する
rynsuke
1
170
AIのAIによるAIのための出力評価と改善
chocoyama
2
550
あなたの声を届けよう! 女性エンジニア登壇の意義とアウトプット実践ガイド #wttjp / Call for Your Voice
kondoyuko
4
450
SalesforceArchitectGroupOsaka#20_CNX'25_Report
atomica7sei
0
170
BigQuery Remote FunctionでLooker Studioをインタラクティブ化
cuebic9bic
3
300
AWS CDK 実践的アプローチ N選 / aws-cdk-practical-approaches
gotok365
6
750
Navigation3でViewModelにデータを渡す方法
mikanichinose
0
220
Amazon Bedrockで実現する 新たな学習体験
kzkmaeda
2
550
生成AIで小説を書くためにプロンプトの制約や原則について学ぶ / prompt-engineering-for-ai-fiction
nwiizo
4
1.8k
強化されたAmazon Location Serviceによる新機能と開発者体験
dayjournal
2
210
Snowflake Summit 2025 データエンジニアリング関連新機能紹介 / Snowflake Summit 2025 What's New about Data Engineering
tiltmax3
0
310
250627 関西Ruby会議08 前夜祭 RejectKaigi「DJ on Ruby Ver.0.1」
msykd
PRO
2
290
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
Automating Front-end Workflow
addyosmani
1370
200k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Building an army of robots
kneath
306
45k
Designing for humans not robots
tammielis
253
25k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
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