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
P2P ではじめる WebRTC のつまづきどころ
tnoho
1
270
[MIRU2025]Preference Optimization for Multimodal Large Language Models for Image Captioning Tasks
keio_smilab
PRO
0
100
機械学習を「社会実装」するということ 2025年夏版 / Social Implementation of Machine Learning July 2025 Version
moepy_stats
1
1.4k
claude codeでPrompt Engineering
iori0311
0
530
AI時代の知識創造 ─GeminiとSECIモデルで読み解く “暗黙知”と創造の境界線
nyagasan
0
160
AWS表彰プログラムとキャリアについて
naoki_0531
1
140
「育てる」サーバーレス 〜チーム開発研修で学んだ、小さく始めて大きく拡張するAWS設計〜
yu_kod
1
180
LLMでAI-OCR、実際どうなの? / llm_ai_ocr_layerx_bet_ai_day_lt
sbrf248
0
120
なぜAI時代に 「イベント」を中心に考えるのか? / Why focus on "events" in the age of AI?
ytake
2
800
AIエージェントを支える設計
tkikuchi1002
11
2.3k
Step Functions First - サーバーレスアーキテクチャの新しいパラダイム
taikis
1
280
株式会社島津製作所_研究開発(集団協業と知的生産)の現場を支える、OSS知識基盤システムの導入
akahane92
1
1.3k
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing for humans not robots
tammielis
253
25k
Agile that works and the tools we love
rasmusluckow
329
21k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
GitHub's CSS Performance
jonrohan
1031
460k
Writing Fast Ruby
sferik
628
62k
How STYLIGHT went responsive
nonsquared
100
5.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
How to train your dragon (web standard)
notwaldorf
96
6.1k
Docker and Python
trallard
45
3.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
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