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
530
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
100
Other Decks in Technology
See All in Technology
サーバー間 GraphQL と webmock-graphql の話 / server-to-server graphql and webmock-graphql
qsona
2
180
ChatGPT for IT Service Management (IT Pro)
dahatake
7
1.5k
MySQL の SQL クエリチューニングの要所を掴む勉強会
andpad
2
6k
エンジニアのキャリアをちょっと楽しくする3本の軸/Three Pillars to Make an Engineer's Career More Enjoyable
kwappa
0
2.6k
MapLibreとAmazon Location Service
dayjournal
1
150
検証を通して見えてきたTiDBの性能特性
lycorptech_jp
PRO
6
3.7k
「スニダン」開発組織の構造に込めた意図 ~組織作りはパッションや政治ではない!~
rinchsan
3
530
オーナーシップを持つ領域を明確にする
konifar
13
3.1k
SIEMを用いて、セキュリティログ分析の可視化と分析を実現し、PDCAサイクルを回してみた
coconala_engineer
0
280
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
260
Delivering Millions of Messages within seconds @ Duolingo
pelelgrino
0
350
自己改善からチームを動かす! 「セルフエンジニアリングマネージャー」のすゝめ
shoota
6
250
Featured
See All Featured
Music & Morning Musume
bryan
41
5.6k
Fireside Chat
paigeccino
21
2.6k
Agile that works and the tools we love
rasmusluckow
325
20k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
A better future with KSS
kneath
231
16k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
Visualization
eitanlees
136
14k
Building Your Own Lightsaber
phodgson
99
5.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
16
2.6k
Building Applications with DynamoDB
mza
88
5.6k
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