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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kenta Takahashi
October 25, 2025
Programming
0
20
TokenSourceを理解する
https://asakusago.connpass.com/event/369325/
Kenta Takahashi
October 25, 2025
Tweet
Share
More Decks by Kenta Takahashi
See All by Kenta Takahashi
xDS を活用したサービスディスカバリーで実現するブランチ別 QA 環境の構築手法
knwoop
2
830
Fastly Compute @ Kauche
knwoop
0
65
How Are Random Numbers Generated ?
knwoop
0
310
認証認可とGoの話
knwoop
3
1.2k
Other Decks in Programming
See All in Programming
Docコメントで始める簡単ガードレール
keisukeikeda
1
120
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
190
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
270
SourceGeneratorのマーカー属性問題について
htkym
0
200
How to stabilize UI tests using XCTest
akkeylab
0
130
AHC061解説
shun_pi
0
400
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
安いハードウェアでVulkan
fadis
0
470
Codex の「自走力」を高める
yorifuji
0
1.2k
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
580
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
Side Projects
sachag
455
43k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Exploring anti-patterns in Rails
aemeredith
2
290
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
Building Adaptive Systems
keathley
44
3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
320
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.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 ͳͲ͋ΔͷͰศར