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
About_JWT_at_NDS_39_Niigata_pm
Search
ritou
December 13, 2014
Technology
2
480
About_JWT_at_NDS_39_Niigata_pm
NDS#39 Niigata.pm tech talk
http://connpass.com/event/8695/
で発表した資料です。
ritou
December 13, 2014
Tweet
Share
More Decks by ritou
See All by ritou
“パスワードレス認証への道" ユーザー認証の変遷とパスキーの関係
ritou
1
1.6k
パスキー導入の課題と ベストプラクティス、今後の展望
ritou
11
3.7k
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 + α
ritou
0
90
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 @ AXIES 2024
ritou
4
1.7k
OIDF-J EIWG 振り返り
ritou
2
50
そのQRコード、安全ですか? / Cross Device Flow
ritou
4
500
MIXI Mと社内外のサービスを支える認証基盤を作るためにやってきたこと #MTDC2024
ritou
3
610
Passkeys and Identity Federation @ OpenID Summit Tokyo 2024
ritou
2
810
Webアプリ開発者向け パスキー対応の始め方
ritou
4
6.4k
Other Decks in Technology
See All in Technology
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
38k
新卒から4年間、20年もののWebサービスと向き合って学んだソフトウェア考古学 - PHPカンファレンス新潟2025 / new graduate 4year software archeology
oguri
2
350
Devin&Cursor、それぞれの「本質」から導く最適ユースケース戦略
empitsu
8
2.4k
継続戦闘能⼒
sansantech
PRO
0
220
MCP Clientを活用するための設計と実装上の工夫
yudai00
1
790
ソフトウェアは捨てやすく作ろう/Let's make software easy to discard
sanogemaru
10
5.8k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.6k
MCP で繋ぐ Figma とデザインシステム〜LLM を使った UI 実装のリアル〜
kimuson
2
1.3k
LT:組込み屋さんのオシロが壊れた!
windy_pon
0
350
What's Next in OpenShift Q2 CY2025
redhatlivestreaming
1
790
うちの会社の評判は?SNSの投稿分析にAIを使ってみた
doumae
0
110
CloudBruteによる外部からのS3バケットの探索・公開の発見について / 20250605 Kumiko Hennmi
shift_evolve
3
130
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
35
6.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
106
19k
Designing for humans not robots
tammielis
253
25k
A designer walks into a library…
pauljervisheath
205
24k
How to Ace a Technical Interview
jacobian
276
23k
Automating Front-end Workflow
addyosmani
1370
200k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
180
53k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.2k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
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