Upgrade to Pro — share decks privately, control downloads, hide ads and more …

oauth2_productivity_presentation.pdf

Avatar for subaru subaru
August 16, 2025

 oauth2_productivity_presentation.pdf

Avatar for subaru

subaru

August 16, 2025
Tweet

More Decks by subaru

Other Decks in Technology

Transcript

  1. 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)
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 24

  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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