Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Add ability to embed and use OAuth creds in a waypoint token #3298

Merged
merged 5 commits into from
May 3, 2022

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Apr 28, 2022

This opens up the authentication modes for waypoint clients talking to a server to be able to delegate the authentication to an OAuth2 provider. This is only client support, the server does not yet expose this functionality, but it is available for future server implementations to use.

@github-actions github-actions bot added the core label Apr 28, 2022
@xiaolin-ninja
Copy link
Contributor

                                  (Not in the PR)                                    
                     ┌───────────8. OAuth dance to ─────────────────┐                
                     │            validate token.                   │                
                     │                                              ▼                
                     │                                        ┌──────────┐           
                     │                                        │  OAuth   │           
                     │                                     ┌──│  Server  │◀─┐        
                     │                                     │  │          │  │        
                     │                                     │  └──────────┘  │        
                     │                                     │                │        
                     │                                     │                │        
                     │                                6. Yeah ok, I         │        
                     │                                  know you.      5. Can I have 
                     │   ┌─────────────────────┐           │             an OAuth    
                     │   │                     │           │            token pls?   
                     ▼   ▼                     │           └────────┐    Here's my   
                  ┌────────────┐             7. Hi! Can             │      info.     
                  │  Waypoint  │             you handle             │       │        
               ┌─▶│   Server   │──────┐        │this                │       │        
               │  │            │      │       request,              │       │        
               │  └────────────┘      │      here's my              ▼       │        
               │                      │        OAuth                Λ       │        
               │                2. Here you    token.              ╱ ╲      │        
               │                   go, I       │                  ╱   ╲     │        
               │                smuggled an    │                 ╱     ╲    │        
               │                   OAuth       │                ╱       ╲   │        
           1. I want              server       └───────────────▕ client  ▏──┘        
           a Waypoint            address &                      ╲       ╱            
             token              credentials                      ╲    4. Oh, there's 
               │                  in it.                          ╲   OAuth info in  
               │                      │                            ╲ ╱    this!      
               │                      │                             V                
               │                      │                             ▲                
               │                      │                             │                
               │            .─────.   │                        3. Client, do         
               │           ; User  :  │                         your thing.          
               └───────────:       ;◀─┘                          Here's my           
                            ╲     ╱                              Waypoint            
                             `───'                             access token          
                               │                                    │                
                               │                                    │                
                               └────────────────────────────────────┘                

@xiaolin-ninja
Copy link
Contributor

Here is the gist version of the OAuth flow diagram above.

pkg/server/proto/server.proto Outdated Show resolved Hide resolved
// tokenMagic is used as a byte sequence prepended to the encoded TokenTransport to identify
// the token as valid before attempting to decode it. This is mostly a nicity to improve
// understanding of the token data and error messages.
tokenMagic = "wp24"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not ideal to duplicate the token magic, but not the worst.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to leave the duplication for now, refactoring for this one thing is more ugly.

Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! We went over this in a team zoom and I asked my questions there 😄

@evanphx evanphx merged commit c8a0db3 into main May 3, 2022
@evanphx evanphx deleted the f-oauth-token branch May 3, 2022 21:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants