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
64
“ID沼入口” - 基本とセキュリティから始める、考え続けるためのID管理技術勉強会 告知&イントロ
ritou
0
700
認証認可だけじゃない! ID管理の構成要素と ライフサイクルを意識しよう
ritou
1
900
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
2
1.5k
“パスワードレス認証への道" ユーザー認証の変遷とパスキーの関係
ritou
2
7.7k
パスキー導入の課題と ベストプラクティス、今後の展望
ritou
12
9.6k
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
スクラム祭り2026福井トラック_閉じたループから価値のスパイラルへ
kc_nakanishi
0
170
Vue.jsのGitHubから学ぶ意思決定
yut0naga1_fa
1
270
Codex を使った障害対応机上演習の実際
orgachem
PRO
0
360
sue445's proposals 2026
sue445
0
150
正解のない研修に放り出されて / Being thrown into a training program with no right answers
ohnoeight
1
150
推論基盤と Scale-Up Interconnect の現状と制約から俯瞰する技術動向
markunet
2
180
AI時代、つくる力を自分たちの手に。 ──電通×KAG、アジャイルとAI駆動開発で挑む開発の変革
yuukiyo
3
390
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
200
ドメインエキスパートは いかにして AI を使って プロダクト開発をするか
tatsuyashiraishi
1
190
Metadata - Section 2: Simple Metadata & Meta Tags
mohab1
0
140
渡米前の準備を制す!re:Invent 2026徹底準備術 / The Ultimate Preparation Guide for re:Invent 2026
yuj1osm
1
260
企画を Software Factory-ready にする——開発が高速になったとき、PdMの仕事はどう変わったか
yachibit
1
270
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
940
Build your cross-platform service in a week with App Engine
jlugia
234
19k
The browser strikes back
jonoalderson
0
1.9k
From π to Pie charts
rasagy
1
410
Writing Fast Ruby
sferik
630
63k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
290
GraphQLとの向き合い方2022年版
quramy
50
15k
Are puppies a ranking factor?
jonoalderson
2
4.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
440
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