Share
Embed
Transcript
37 slides
-
1 Boosting Development Productivity Boosting Development Productivity Boosting Development Productivity
Through Lessons Learned from Through Lessons Learned from Through Lessons Learned from Implementing OAuth2.0 Implementing OAuth2.0 Implementing OAuth2.0 Subaru @ AI Shift (CyberAgent Group) Subaru @ AI Shift (CyberAgent Group) Subaru @ AI Shift (CyberAgent Group) -
Today's Journey Let's discover how OAuth2.0 implementation taught us universal
lessons about development productivity! Not just OAuth2.0 technical details ▸ Patterns & practices for faster development ▸ Real story: Significant productivity improvements ▸ 2 -
The Bottom Line First 3 Key Success Factors for Productivity
Enhancement Leverage Standardized Specs (RFCs) Create Shared Team Language Invest in Foundation Well-debated specs make implementation easy ▸ Years of discussion already done for you ▸ Clean Architecture as communication tool ▸ Reduce cognitive load for humans AND AI ▸ Automated testing and CI/CD ▸ Compound benefits over time ▸ 3 -
Four Fundamental Components Based on our architecture: → Authentication needed
for Tools! Instruction - Agent's job description 1. Model - GPT-4, Claude, etc. 2. Memory - Conversation history & context 3. Tool - External service integration 4. 7 -
The Challenge Tool Security Requirements When AI agents use tools
to access external services: Solution needed: Cross-service auth for both AI Worker & AI Studio Without Authentication → Security vulnerabilities ▸ Without Authorization → No access control ▸ 8 -
Context: My Journey 1 Month Into the Job The Situation:
The Question: How can a new engineer deliver significant value quickly? → Spoiler: Standards, team support, and good architecture! New to the company and codebase ▸ Tasked with adding auth to our AI agent platform ▸ Need to understand existing architecture quickly ▸ 9 -
10 OAuth Evolution & RFCs OAuth Evolution & RFCs OAuth
Evolution & RFCs -
Authentication History Generation 1: The Dark Ages Generation 2: OAuth
1.0 (2007) Separate username/password everywhere ▸ Password fatigue was real ▸ Security nightmare ▸ Revolutionary: Grant access without sharing passwords! ▸ But incredibly complex to implement ▸ HMAC-SHA1 signatures = debugging nightmare ▸ 11 -
OAuth 1.0 Complexity Why It Was Painful Authorization: OAuth realm="Example",
oauth_consumer_key="9djdj82h48djs9d2", oauth_token="kkk9d7dh3k39sjv7", oauth_signature_method="HMAC-SHA1", oauth_timestamp="137131201", oauth_nonce="7d8f3e4a", oauth_signature="bYT5CMsGcbgUdFHObYMEfcx6bsw%3D" https://datatracker.ietf.org/doc/html/rfc5849#section-1.2 Normalize query parameters in specific order ▸ Calculate signature base string precisely ▸ One wrong character = complete failure ▸ Engineers spent days debugging ▸ 12 -
Modern OAuth Generation 3: OAuth 2.0 (2012) Generation 4: OAuth
2.1 (Draft) RFC 6749 - The game changer! ▸ HTTPS everywhere = no complex signatures ▸ Multiple flows for different use cases ▸ Dramatically easier implementation ▸ draft-ietf-oauth-v2-1 ▸ Security best practices built-in ▸ PKCE mandatory ▸ Removing insecure flows ▸ 13 -
OAuth 1.0 vs 2.0: Complete Overhaul OAuth 1.0 (2007) OAuth
2.0 (2012) Complex Signatures HTTPS Only HMAC-SHA1 for every request Delegate security to TLS Debugging nightmare Simple Bearer tokens Long-lived Tokens Short-lived + Refresh Year-long or permanent Minutes to hours Security risk if compromised Auto-refresh mechanism Single Flow Multiple Flows One-size-fits-all Authorization Code, Implicit, Client Credentials, etc. Hard to adapt Perfect fit for each use case 14 -
OAuth 2.0 Protocol Flow +--------+ +---------------+ | |--(A)- Authorization Request
->| Resource | | | | Owner | | |<-(B)-- Authorization Grant ---| | | | +---------------+ | | | | +---------------+ | |--(C)-- Authorization Grant -->| Authorization | | Client | | Server | | |<-(D)----- Access Token -------| | | | +---------------+ | | | | +---------------+ | |--(E)----- Access Token ------>| Resource | | | | Server | | |<-(F)--- Protected Resource ---| | +--------+ +---------------+ 15 -
Why RFCs Matter RFC = Collective Wisdom Request for Comments
represents: Key OAuth RFCs: Years of debate & review ▸ Real-world testing by thousands ▸ Industry-proven solutions ▸ RFC 6749 - OAuth 2.0 Core ▸ RFC 6750 - Bearer Tokens ▸ RFC 7636 - PKCE ▸ OpenID Connect - Authentication layer ▸ 16 -
The Power of Standards What RFCs Give You Security -
CSRF prevention, URI validation, token expiration Guidance - Clear actors, flow selection, error handling Community - Libraries, Stack Overflow, battle-tested 17 -
18 Three Phases of Implementation Three Phases of Implementation Three
Phases of Implementation -
Phase 1: Design OAuth 2.0 RFC as Expert Architect Four
Actors Clearly Defined: This clarity accelerated design decisions! Resource Owner → Our users ▸ Client → Our AI agents ▸ Authorization Server → Validates credentials ▸ Resource Server → External APIs ▸ 19 -
Design: Flow Selection Why Authorization Code Flow? After analyzing requirements
with RFC guidance: Secure credential storage - Server-side secrets Refresh token support - Long-running agents PKCE protection - Future-proof security 20 -
Design: Security Built-In RFC Security Checklist Following RFC 6749 security
considerations: Result: Security review passed on first attempt! State parameter implementation ▸ Redirect URI validation(PKCE+state) ▸ Token expiration strategy ▸ Scope limitation ▸ HTTPS enforcement ▸ 21 -
Design: Team Support Value Leveraging Collective Knowledge As a new
engineer (1 month in): "That won't work with our session management" "AI Studio uses different tokens - here's how..." Real-time collaboration = Faster, better design Created sequence diagrams with Claude Code ▸ Shared on Slack for instant review ▸ Team spotted integration issues early ▸ 22 -
Implementation: Shared Language Architecture as Communication Tool Say this: "OAuth
token validation goes in Use Case layer" Everyone understands: No lengthy explanations needed! Business logic location ▸ Testing approach ▸ Dependencies direction ▸ 25 -
Implementation: Benefits Clean Architecture Advantages 1. Reduced Communication 2. AI
Synergy 3. Independent Testing Faster reviews, clear locations, quick onboarding ▸ Better generation, reduced cognitive load, consistent patterns ▸ Mock servers, isolated layers, business logic testing ▸ 26 -
Implementation: Testing Strategy Comprehensive Test Coverage describe('OAuth Implementation', () =>
{ // Happy path scenarios it('should refresh access token when expired') it('should exchange auth code for tokens') // Error scenarios it('should reject requests with invalid state') it('should handle network failures gracefully') }) Quick coverage check = Reviewer confidence Just seeing normal & error cases covered was incredibly helpful! 27 -
Phase 3: Release CI/CD Pipeline Benefits Every Push Automatically: GitOps
with ArgoCD: Outcome: Fearless iteration! Linting & type checking ▸ Full test suite execution ▸ Gemini AI code review (first-pass) ▸ Environment validation ▸ Runs on Kubernetes ▸ Auto-deploy on merge to main ▸ 28 -
Release: Automation Impact From Code to Production push to branch
→ Gemini AI review (instant) → Run tests → Human review (reduced burden) → Merge to main → ArgoCD auto-deploy (GitOps) → Live on Kubernetes! Developer experience: AI catches issues early ▸ Reduced review burden ▸ Automatic deployment via GitOps ▸ 29 -
Release: The Results Significant Productivity Gains Metrics that mattered: Achievement
unlocked: New engineer (1 month in) successfully shipped critical auth infrastructure! Time to production: Days → Hours ▸ Security issues found: Before production ▸ Rollback needed: Zero times ▸ Team confidence: Sky high ▸ 30 -
Three Critical Success Factors 1. Leverage Standardized Specifications Well-debated specs
= Easy implementation The hard thinking is done for you OAuth RFCs = Years of rigorous discussion ▸ Edge cases already discovered and solved ▸ Battle-tested through real-world usage ▸ Focus on your unique business logic ▸ Implement proven patterns confidently ▸ Skip the design debates, go straight to building ▸ 32 -
Three Critical Success Factors 2. Harness Team Knowledge Design reviews
save time Create knowledge-sharing structures Early feedback prevents rework ▸ Collective experience > Individual brilliance ▸ Slack channels for quick questions ▸ Documentation in code ▸ Pair programming sessions ▸ 33 -
Three Critical Success Factors 3. Invest in Architecture & Tooling
Clean Architecture = Shared Language Automation = Compound Benefits These investments pay dividends forever! Faster communication ▸ Easier onboarding ▸ Better AI assistance ▸ Testing gives confidence ▸ CI/CD gives speed ▸ Both give peace of mind ▸ 34 -
Recap: The Formula for Success 3 Key Success Factors Applied
1. Leveraged Standardized Specs (RFCs) 2. Created Shared Team Language 3. Invested in Foundation Used OAuth 2.0 RFC 6749 as blueprint ▸ Years of debate made implementation straightforward ▸ Clean Architecture enabled clear communication ▸ Reduced cognitive load for team AND AI ▸ Automated testing and CI/CD from day one ▸ Compound benefits realized quickly ▸ 35 -
36 Technology Evolves, So Should We Technology Evolves, So Should
We Technology Evolves, So Should We -
37 Thank You! Thank You! Thank You! Questions? Let's discuss
during networking! Questions? Let's discuss during networking! Questions? Let's discuss during networking! Contact Contact: @247Subaru : @247Subaru : @247Subaru