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
Amazon AlexaとのAccount Linking
Search
Recruit Technologies
March 29, 2018
Technology
1
1.4k
Amazon AlexaとのAccount Linking
2018/03/23 OpenID TechNight Vol.15での、高木の講演資料になります
Recruit Technologies
March 29, 2018
Tweet
Share
More Decks by Recruit Technologies
See All by Recruit Technologies
障害はチャンスだ! 障害を前向きに捉える
rtechkouhou
1
560
Flutter移行の苦労と、乗り越えた先に得られたもの
rtechkouhou
3
10k
ここ数年間のタウンワークiOSアプリのエンジニアのチャレンジ
rtechkouhou
1
1.4k
大規模環境をAWS Transit Gatewayで設計/移行する前に考える3つのポイントと移行への挑戦
rtechkouhou
1
1.8k
【61期 新人BootCamp】TOC入門
rtechkouhou
3
40k
【RTC新人研修 】 TPS
rtechkouhou
1
39k
Android Boot Camp 2020
rtechkouhou
0
39k
HTML/CSS
rtechkouhou
10
48k
TypeScript Bootcamp 2020
rtechkouhou
9
44k
Other Decks in Technology
See All in Technology
オブジェクト指向CSSが叶えたかったことと、CSSのいま / The aims of Object-oriented CSS and the current state of CSS usage
shinkufencer
11
3.7k
Vos logs méritent mieux que la config par défaut
lyrixx
2
410
技術イベントはなんとかひねり出す 日経の技術広報の取り組み/techpr3
nishiuma
0
230
暗黙知を集積するプラットフォーム : 「健常者エミュレータ事例集」の取り組み
sora32127
1
170
コードレビューを支援するAI技術の応用
akkie76
2
170
家族アルバム みてねで直面してきた技術的負債 / MIXI KAG 2024
isaoshimizu
17
7.7k
技術広報として2023年度に頑張ったこと / What we did well in FY2023 as a DevRel
pauli
5
490
複数の LLM モデルを扱う上で直面した辛みまとめ
kazuyaseki
1
260
KubeCon EU: Unlocking new Platform Experiences with Open Interfaces
salaboy
1
380
統計的学習理論読み Chapter 1
kmatsui
4
970
関数型DDDの理論と実践:「決定を遅らせる」を先につくり、 ビジネスの機動力と価値をあげる
knih
2
500
KubeCon EU 2024 : Knative Maintainers Session
salaboy
0
380
Featured
See All Featured
Debugging Ruby Performance
tmm1
68
11k
What’s in a name? Adding method to the madness
productmarketing
PRO
14
2.6k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
19
1.6k
Bash Introduction
62gerente
604
210k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
Designing with Data
zakiwarfel
94
4.8k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
101
6.6k
Unsuck your backbone
ammeep
661
56k
Designing the Hi-DPI Web
ddemaree
275
33k
Agile that works and the tools we love
rasmusluckow
323
20k
Transcript
TechNight #15 Amazon AlexaとのAccount Linking リクルートテクノロジーズ IDP部
(C) Recruit Technologies Co.,Ltd. All rights reserved. 1 高木
公平 リクルートテクノロジーズ ITソリューション統括本部 ID・ポイント部 グループマネージャー 自己紹介
(C) Recruit Technologies Co.,Ltd. All rights reserved. 2 アジェンダ 1.
はじめに 2. Amazon Alexaへの取り組み 3. Account Linking 対応 4. まとめ
(C) Recruit Technologies Co.,Ltd. All rights reserved. 3 1. はじめに
(C) Recruit Technologies Co.,Ltd. All rights reserved. 4 リクルートのサービス紹介 日常生活や人生の中の
大きなイベントに関わる サービスを展開
(C) Recruit Technologies Co.,Ltd. All rights reserved. 5 リクルートにおけるIDへの取り組み •
グループ会社40以上のサービスで共通ID化 • OpenID Connect及びOAuth2.0に対応 OpenID Connect OAuth2.0
(C) Recruit Technologies Co.,Ltd. All rights reserved. 6 OpenIDファウンデーションへの参加 •
OpenID Certificationを近々取得予定
(C) Recruit Technologies Co.,Ltd. All rights reserved. 7 2. Amazon
Alexaへの取り組み
(C) Recruit Technologies Co.,Ltd. All rights reserved. 8 Alexa対応デバイスとスキル 出典:Alexaアプリより
• 2017年11月にスマートスピーカー「Amazon Echo」が日本発売開始 • 2018年3月12日時点で685スキル が登録済み 出典:Amazon ホームページより ※ ※弊社調査結果
(C) Recruit Technologies Co.,Ltd. All rights reserved. 9 スキル実行の仕組み 出典:「Alexaスキル開発トレーニングシリーズ
第1回 初めてのスキル開発」より 1. ユーザーがAlexa対応デバイスに発話 2. デバイスはマイクで集音した音声データを、インターネット経由でAlexaサービスに送 信 3. Alexaサービスは音声データをAIで解析し、AWS Lambda(または任意のWEBサービ ス)を呼び出して解析結果を伝える 4. Lambda (または任意のWEBサービス)はスキルの処理を実行し、その結果をAlexa サービスにレスポンスとして返す 5. Alexaサービスはレスポンスに応じた音声データを生成、デバイスに返信 6. デバイスは音声データを再生し、ユーザーに伝える
(C) Recruit Technologies Co.,Ltd. All rights reserved. 10 スキルの種類 出典:「Alexaスキルキット
ディベロッパーコンソール」より 1.カスタムスキル 2.フラッシュブリーフィングスキル 3.スマートホームスキル 4.ビデオスキル
(C) Recruit Technologies Co.,Ltd. All rights reserved. 11 スキルの種類 出典:「Alexaスキルキット
ディベロッパーコンソール」より 1.カスタムスキル 2.フラッシュブリーフィングスキル 3.スマートホームスキル 4.ビデオスキル
(C) Recruit Technologies Co.,Ltd. All rights reserved. 12 リクルートのスキル
(C) Recruit Technologies Co.,Ltd. All rights reserved. 13 3. Account
Linking 対応 カスタムスキルのAccount LinkingをAuthorization Code Grantで実装してみよう!
(C) Recruit Technologies Co.,Ltd. All rights reserved. 14 Account Linkingとは
• Alexaユーザーと、システム(スキル)ユーザーを関連 付ける仕組みで、予約や購入など本人特定が必要なア クションで利用 • The OAuth 2.0 Authorization Framework(RFC 6749)をベースに設計されている • 対応するOAuth Grant Typeは2つ - Authorization Code Grant - Implicit Grant • 日本国内で有効なスキルでは、76スキル(685スキル 中)が対応済 ※ ※弊社調査結果
(C) Recruit Technologies Co.,Ltd. All rights reserved. 15 Account Linkingとは
devサイトは 日本語対応済み
(C) Recruit Technologies Co.,Ltd. All rights reserved. 16 Account Linking設定
(C) Recruit Technologies Co.,Ltd. All rights reserved. 17 Account Linking設定
Authorization URI Client ID Domain List Scope Redirect URLs Authorization Grant Type Access Token URI Client Secret Client Authentication Scheme
(C) Recruit Technologies Co.,Ltd. All rights reserved. 18 登場人物 •
Amazon Alexa Backend Server OAuth Client • 3rd-party: Backend Server (e.g.ホットペッパーグルメ) OAuth Resource Server (RS) • 3rd-party: ID Server(e.g.リクルートID) OAuth Authorization Server (AS)
(C) Recruit Technologies Co.,Ltd. All rights reserved. 19 Account Linking全体フロー
Authorization Request Client Resource Server Authorization Server Authorization Code Authorization Code Access Token 1. Clientから AS に 対して認可 要求 2. AS がユーザー認証 & 同意取 得 3. AS が Client に Authorization Codeを返す 4. Clientが AS から Access Tokenを取得 5. Alexa Account と AS の Access Token を紐づけて保存 し、Account Linking完了 Link!
(C) Recruit Technologies Co.,Ltd. All rights reserved. 20 1. Clientから
AS に 対して認可要求 Authorization Request Account Linkingフロー “有効にする”をクリック Client Resource Server Authorization Server
(C) Recruit Technologies Co.,Ltd. All rights reserved. 21 2. AS
がユーザー認証 & 同意取得 Account Linkingフロー Client Resource Server Authorization Server
(C) Recruit Technologies Co.,Ltd. All rights reserved. 22 3. AS
が Client に Authorization Codeを返す Account Linkingフロー Client Resource Server Authorization Server Authorization Code
(C) Recruit Technologies Co.,Ltd. All rights reserved. 23 4. Clientが
AS から Access Tokenを取得 Account Linkingフロー Client Resource Server Authorization Server Authorization Code Access Token
(C) Recruit Technologies Co.,Ltd. All rights reserved. 24 5. Alexa
Account と AS の Access Tokenを紐づけて保存し、 Account Linking完了 Account Linkingフロー Client Resource Server Authorization Server
(C) Recruit Technologies Co.,Ltd. All rights reserved. 25 検討ポイント①:誰にどんなサービスを提供するか 例)
• 誰に?: • 全てのユーザーに • WEBサービスの既存ユーザーに • どんな?: • 検索した中からお店を予約 • 過去に行ったお店を予約
(C) Recruit Technologies Co.,Ltd. All rights reserved. 26 appendix:Account Linking全体フロー
Authorization Request Client Resource Server Authorization Server Authorization Code Authorization Code Access Token Link!
(C) Recruit Technologies Co.,Ltd. All rights reserved. 27 サービス利用時の全体フロー Client
Resource Server Authorization Server 1. Amazon Echo に音声で指示 (Alexa Backend に音声データ が届く) 2. 音声データを JSON 化 3. Alexa Backend が当該 Alexa Accountに紐づいた Access Token を付けて RS にリクエスト 4. RS はJWT形式のAccess Token を検証 5. RS が Alexa Backendにレスポン ス返却 6. Alexa Backend は RS のレスポ ンスを音声データ化 7. Alexa Backend は Echoに音声 データ返却 音声 音声データJSON化 Access Token + 音声データ Access Token検証 音声データ 音声
(C) Recruit Technologies Co.,Ltd. All rights reserved. 28 1. Amazon
Echo に音声で指示 (Alexa Backend に音声デー タが届く) 2. 音声データを JSON 化 3. Alexa Backend が当該 Alexa Accountに紐づいた Access Token を付けて RS にリクエ スト サービス利用時のフロー Client Resource Server Authorization Server 音声 音声データJSON化 Access Token + 音声データ
(C) Recruit Technologies Co.,Ltd. All rights reserved. 29 4. RS
はJWT形式のAccess Token を検証 サービス利用時のフロー Client Resource Server Authorization Server Access Token検証
(C) Recruit Technologies Co.,Ltd. All rights reserved. 30 検討ポイント②:Access Tokenの検証方法
• アクセストークン検証方法 認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 4.トークン検証要求 5.トークン検証結果 6.リソース Token Introspection 認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 5.リソース JWT形式のアクセストークン 4.トークン検証
(C) Recruit Technologies Co.,Ltd. All rights reserved. 31 • アクセストークン検証方法
認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 4.トークン検証要求 5.トークン検証結果 6.リソース Token Introspection 認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 5.リソース JWT形式のアクセストークン 4.トークン検証 検討ポイント②:Access Tokenの検証方法 JWT形式のAccess Token に全 てのメタデータを埋め込む ・署名検証をRSが実施 ・バックエンド通信無しで検証が可 能なため負荷が低い Token の Revokeが難しい ・RSは都度ASに問い合わせてこない ため、Lifetimeの短いAccess Token を発行 RS->AS へのバックエンド通 信により検証 ・署名検証をASが実施するため比 較的シンプル ・バックエンド通信が都度発生する ため負荷が高い TokenのRevokeが簡単 ・RSがASに問い合わせて来た時点 でRevokeが発覚
(C) Recruit Technologies Co.,Ltd. All rights reserved. 32 • アクセストークン検証方法
認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 4.トークン検証要求 5.トークン検証結果 6.リソース Token Introspection 認可サーバー リソースサーバー クライアント 1.認可要求 2.トークン返却 3.リソースアクセス 5.リソース JWT形式のアクセストークン 4.トークン検証 検討ポイント②:Access Tokenの検証方法
(C) Recruit Technologies Co.,Ltd. All rights reserved. 33 appendix:JWTの中身 Access
Tokenの情報 Header部 • 署名アルゴリズム(alg) • トークンタイプ(typ) • キーID(kid) Payload部 • 発行元 (iss) • 識別子(sub) • 発行先 RS (aud) • 発行日時(iat) • 有効期限(exp) • JWTID(jti) • API のスコープ (scp) • クライアント識別子(cid)
(C) Recruit Technologies Co.,Ltd. All rights reserved. 34 5. RS
が Alexa Backendに レスポンス返却 6. Alexa Backend は RS の レスポンスを音声データ 化 7. Alexa Backend は Echo に音声データ返却 サービス利用時のフロー Client Resource Server Authorization Server JSON 音声
(C) Recruit Technologies Co.,Ltd. All rights reserved. 35 まとめ
(C) Recruit Technologies Co.,Ltd. All rights reserved. 36 まとめ •
The OAuth 2.0 Authorization Frameworkの 前提知識があれば比較的容易に実装可能 • スキルが提供するサービス内容によって、ログ イン画面のUIや、シーケンスを工夫する必要が ある • RSとASが異なる環境にある場合、負荷対策を講 じておいた方が先々安心である