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
35
0
Share
TokenSourceを理解する
https://asakusago.connpass.com/event/369325/
Kenta Takahashi
October 25, 2025
More Decks by Kenta Takahashi
See All by Kenta Takahashi
xDS を活用したサービスディスカバリーで実現するブランチ別 QA 環境の構築手法
knwoop
2
1.1k
Fastly Compute @ Kauche
knwoop
0
69
How Are Random Numbers Generated ?
knwoop
0
320
認証認可とGoの話
knwoop
3
1.2k
Other Decks in Programming
See All in Programming
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
Making the RBS Parser Faster
soutaro
0
710
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.9k
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
5
5.3k
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
140
AIと共に生きる技術選定 2026
sgash708
0
140
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
460
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
180
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.9k
AI Agent と正しく分析するための環境作り
yoshyum
2
450
PHPer、Cloudflare に引っ越す
suguruooki
2
190
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
150
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
Google's AI Overviews - The New Search
badams
0
1k
Paper Plane
katiecoart
PRO
1
50k
Faster Mobile Websites
deanohume
310
31k
Typedesign – Prime Four
hannesfritz
42
3k
It's Worth the Effort
3n
188
29k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
280
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
[SF Ruby Conf 2025] Rails X
palkan
2
1k
Ethics towards AI in product and experience design
skipperchong
2
270
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
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 ͳͲ͋ΔͷͰศར