Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
About_JWT_at_NDS_39_Niigata_pm
Search
ritou
December 13, 2014
Technology
550
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
About_JWT_at_NDS_39_Niigata_pm
NDS#39 Niigata.pm tech talk
http://connpass.com/event/8695/
で発表した資料です。
ritou
December 13, 2014
More Decks by ritou
See All by ritou
FAPIの立ち位置はどう変わる? ~多様化するユースケースを支えるセキュアAPIエコノミー~
ritou
1
60
“ID沼入口” - 基本とセキュリティから始める、考え続けるためのID管理技術勉強会 告知&イントロ
ritou
0
670
認証認可だけじゃない! ID管理の構成要素と ライフサイクルを意識しよう
ritou
1
870
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
2
1.5k
“パスワードレス認証への道" ユーザー認証の変遷とパスキーの関係
ritou
2
7.6k
パスキー導入の課題と ベストプラクティス、今後の展望
ritou
12
9.4k
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 + α
ritou
1
210
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 @ AXIES 2024
ritou
4
1.9k
OIDF-J EIWG 振り返り
ritou
2
130
Other Decks in Technology
See All in Technology
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
280
形式手法を使って仕様をコーディングしよう
mikanichinose
0
180
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
420
Claude起点の仕様駆動開発
tanakaseiya
0
380
ビジネスを止めない技術的負債の返済のための戦略とその手法 - 技術的負債と向き合う / Complexity and Simplicity
soudai
PRO
3
550
SREでアラート疲れを 解決しよう!
kairim0
1
200
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
0
110
営業オントロジーの作り方と、エージェントからの辿り方 ── ナレッジワークの現場から
kworkdev
PRO
1
270
DAMOS - The Smart Cruise Control for RAM
ennael
PRO
1
130
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
140
BedrockとLambdaで作る リアルタイム進行型推理ゲーム
kawametho
0
190
[2026 Oracle Technical Deep Dive] AI時代のアプリケーションを支えるCloud NativeとJava EEモダナイゼーション (2026年9月17日開催)
oracle4engineer
PRO
0
120
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Ruling the World: When Life Gets Gamed
codingconduct
0
380
Docker and Python
trallard
47
4.2k
The Limits of Empathy - UXLibs8
cassininazir
1
700
How to Talk to Developers About Accessibility
jct
2
560
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
420
Designing for humans not robots
tammielis
254
26k
ラッコキーワード サービス紹介資料
rakko
1
5.2M
Exploring anti-patterns in Rails
aemeredith
4
520
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Transcript
1
• • • • 2
3
4
• • • • • 5
6
eyJ .eyJ . 7
[Encoded Header] [Encoded Payload] [Encoded Signature] 8
{"alg":"HS256","typ":"JWT"} 9
{"name":"ritou","title":"About JSON Web Token","date":"2014-12-13"} 10
“Encoded Header + ‘.’ + Encoded Payload” eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoicml0b 3UiLCJ0aXRsZSI6IkFib3V0IEpTT04gV2ViIFRva2VuIiwiZGF0ZSI6I jIwMTQtMTItMTMifQ
11
12
13
14
• JWS(JSON Web Signature) : 署名つき • • JWA(JSON Web
Algorithm) : 署名生成/暗号化の アルゴリズム • JWK(JSON Web Key) : 鍵まわり 15
16
• • • • • • 17
18
19
20
• 21
iss [ID Tokenの発行元] sub [ユーザーID] aud [ID Tokenの発行先] 22
• • • 23
24
25
26
• • • • 27
$options->{id} はセッションID(ランダムな文字列) $options->{id} $options->{id} 28
my $cookie = crush_cookie($env->{HTTP_COOKIE} || '')->{$self- >{cookie_name}}; my $session =
$self->{store}->get($cookie) or return; $session = $self->{serializer}->[1]->($session) if $self->{serializer}; 29
• • Session IDを含むJWS • • JWS検証後 30
::JWSCookie $options->{id} はセッションID(ランダムな文字列) my $jws = encode_jwt({ id => $options->{id}
}, $self->secret, $self->alg); $jws $jws 31
::JWSCookie my $cookie = crush_cookie($env->{HTTP_COOKIE} || '')->{$self->{cookie_name}}; # JWSの検証 $payload
= decode_jwt($cookie, $self->secret, 0); 32
::JWSCookie my $id = $payload->{id}; my $session = $self->{store}->get($id) or
return; 33
• • • • 34
35
http://d.hatena.ne.jp/ritou/20140927/1411811648 36
• • • 37
38
• • • • • 39
40
• • • • • 41
42
• • • 43
44
• • • 45
• • • 46
47