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
TokenSourceを理解する
Search
Kenta Takahashi
October 25, 2025
Programming
0
13
TokenSourceを理解する
https://asakusago.connpass.com/event/369325/
Kenta Takahashi
October 25, 2025
Tweet
Share
More Decks by Kenta Takahashi
See All by Kenta Takahashi
Fastly Compute @ Kauche
knwoop
0
59
How Are Random Numbers Generated ?
knwoop
0
300
認証認可とGoの話
knwoop
3
1.2k
Other Decks in Programming
See All in Programming
高速開発のためのコード整理術
sutetotanuki
1
360
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.8k
Data-Centric Kaggle
isax1015
2
740
dchart: charts from deck markup
ajstarks
3
980
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
2026年 エンジニアリング自己学習法
yumechi
0
120
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
180
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
200
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
160
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
270
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
620
Python札幌 LT資料
t3tra
7
1.1k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
340
58k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
Context Engineering - Making Every Token Count
addyosmani
9
640
The Limits of Empathy - UXLibs8
cassininazir
1
210
Done Done
chrislema
186
16k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
The SEO identity crisis: Don't let AI make you average
varn
0
62
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Deep Space Network (abreviated)
tonyrice
0
38
Into the Great Unknown - MozCon
thekraken
40
2.2k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
190
Transcript
Kenta Takahashi golang.org/x/oauth2#TokenSource Λશʹཧղ͢Δ Asakusa.go
None
αʔϏεؒͰೝূΛͲ͏͓ͬͯ͜ͳ͏͔?
ͱʹ͔ͨ͘͘͞Μ͋Δ • OAuth2/OpenIDConnect ΫϥΠΞϯτೝূ • GitHub Actions ͱ Google Cloud/AWS
• Google Cloud Ͱͷೝূํ๏ • AWS Ͱͷೝূํࣜ
OAuth2 /OenID Connect ΫϥΠΞϯτೝূ • client_secret_post • client_secret_basic • client_secret_jwt
• private_key_jwt • tls_client_auth • ...
GitHub Actions ͱ Google Cloud/AWS https://docs.github.com/ja/actions/concepts/security/openid-connect
Google Cloud Ͱͷೝূํ๏ • Set up Application Default Credentials ͱ͍
͏Έ͕͋Δ • ͬ͘͟Γೝূใͷ୳ ͠ํϚχϡΞϧ
AWS Ͱͷೝূํࣜ • ͋Μ·Γৄ͘͠ͳ͍ͷͰׂѪ
ͳΔ΄ͲΘ͔ΒΜ
API ϦΫΤετ͍͚ͨͩ͠ͳΜͩ
TokenSource ʹ͍ͭͯ https://pkg.go.dev/golang.org/x/oauth2#TokenSource
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ golang.org/x/oauth2 SSO ͷྫ
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ golang.org/x/oauth2 - access token Λͬͯ ϢʔβʔใΛऔಘ͢Δ - ͜ͷ෦Ͱ
Token Source ͕ΘΕ͍ͯΔ
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ golang.org/x/oauth2
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ golang.org/x/oauth2 - Request ͝ͱʹ TokenSource ͷ ϝιου͕ݺΕ͍ͯΔ -
෦ token ͷߋ৽ͳͲ ߦ͍ͬͯΔ - ϩοΫͱͬͯ goroutine-safe ʹ ͳ͍ͬͯΔ
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ GitHub Actions ͱ Google Cloud/AWS (AWS ׂѪ) •
Google Cloud Workload Identity Federation ͱ͍͏ΈΛ͍ͬͯΔ • ೝূΩʔͳ͠Ͱ Google Cloud ʹΞΫηεͰ͖Δ • ෦ͷৄ͍͠Έฉ͍͍ͯͩ͘͞😇
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ GitHub Actions ͱ Google Cloud/AWS (AWS ׂѪ) Workload
Identity Federation ͷྫ https://github.com/knwoop/google-cloud-go-playground/iam/workloadidentityfed
TokenSource Ͳ͜ͰΘΕ͍ͯΔ͔ GitHub Actions ͱ Google Cloud/AWS (AWS ׂѪ) Service
Account ͷྫ
·ͱΊ • TokenSource ɺೝূใͷऔಘΛಁաతʹͯ͘͠ΕΔͷ • API ୟ࣌͘ TokenSource ͚ͩΛҙࣝ͠Α͏ (ݱ࣮ͦΜͳʹ͘ͳ͍😇)
• ·ͣ TokenSource Λ͑ͳ͍͔Λݕ౼ͯ͠ΈΔ • ࠓճհͰ͖ͳ͔͕ͬͨɺ TokenSource Λͬͨ RoundTripper grpc callOptions ͳͲ͋ΔͷͰศར