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
420
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
OIDF-J EIWG 振り返り
ritou
1
5
そのQRコード、安全ですか? / Cross Device Flow
ritou
3
260
MIXI Mと社内外のサービスを支える認証基盤を作るためにやってきたこと #MTDC2024
ritou
2
360
Passkeys and Identity Federation @ OpenID Summit Tokyo 2024
ritou
2
610
Webアプリ開発者向け パスキー対応の始め方
ritou
4
5.7k
様々なユースケースに利用できる "パスキー" の 導入事例の紹介とUXの課題解説 @ DroidKaigi 2023
ritou
3
4.3k
パスキーはユーザー認証を どう変えるのか?その特徴と導入における課題 @ devsumi 2023 9-C-1
ritou
6
12k
Android/Chromeで体験できる 認証のための標準化仕様の 現在と未来 @ DroidKaigi 2022
ritou
2
6.5k
C向けサービスで 使われている認証方式と安全な使い方
ritou
12
2.9k
Other Decks in Technology
See All in Technology
とあるOSSを継続可能にするための取り組みについて / OSS Refactoring Process
bun913
1
210
あなたの知らないiOS開発の世界
recruitengineers
PRO
3
180
eBPFのこれまでとこれから
yutarohayakawa
10
3.2k
Next.js のページ遷移を全力で止める
ypresto
6
3.2k
『GRANBLUE FANTASY Relink』ソフトウェアラスタライザによる実践的なオクルージョンカリング
cygames
0
170
React Aria で実現する次世代のアクセシビリティ
ryo_manba
4
1.2k
OR学会2024秋_短期収益と将来のオフ方策評価性能を考慮したクーポン割当方策混合比の決定
recruitengineers
PRO
4
460
突撃! 隣のAmazon Bedrockユーザー 〜YouはどうしてAWSで?〜
minorun365
PRO
3
390
AIで変わるテスト自動化:最新ツールの多様なアプローチ/ 20240910 Takahiro Kaneyama
shift_evolve
0
230
実務における脅威モデリングを考えよう
nikinusu
0
620
開発生産性を始める前に開発チームができること / optim-improve-development-productivity.pdf
optim
0
110
o1のAPIで実験してみたが 制限きつすぎて辛かった話
pharma_x_tech
0
190
Featured
See All Featured
The Invisible Side of Design
smashingmag
295
50k
Git: the NoSQL Database
bkeepers
PRO
425
64k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
354
29k
Raft: Consensus for Rubyists
vanstee
135
6.5k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
50
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
0
120
It's Worth the Effort
3n
182
27k
Documentation Writing (for coders)
carmenintech
65
4.3k
For a Future-Friendly Web
brad_frost
174
9.3k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.3k
Mobile First: as difficult as doing things right
swwweet
221
8.8k
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