kych

OAuth 2.0 API for Swiyu to enable Taler integration of Swiyu for KYC (experimental)
Log | Files | Refs

info_sequence.txt (1385B)


      1 sequenceDiagram
      2     participant Client
      3     participant OAuth2 Gateway
      4     participant OAuth2 Gateway DB
      5     
      6     Client ->> OAuth2 Gateway: GET /info \nAuthorization: Bearer <token>
      7     
      8     OAuth2 Gateway ->> OAuth2 Gateway: Extract token from \nAuthorization header
      9     
     10     alt Missing or malformed Authorization header
     11         OAuth2 Gateway -->> Client: 401 UNAUTHORIZED \n{error: 'invalid_token'}
     12     else Valid header format
     13         OAuth2 Gateway ->> OAuth2 Gateway DB: UPDATE access_tokens t \nSET revoked = t.revoked \nFROM verification_sessions s \nWHERE t.session_id = s.id \nAND t.token = $1 \nAND t.expires_at > NOW() \nRETURNING t.revoked, s.status, \ns.verifiable_credential
     14         
     15         alt Token not found or expired
     16             OAuth2 Gateway DB -->> OAuth2 Gateway: 0 rows
     17             OAuth2 Gateway -->> Client: 401 UNAUTHORIZED \n{error: 'invalid_token'}
     18         else Token found
     19             OAuth2 Gateway DB -->> OAuth2 Gateway: token and session data
     20             
     21             OAuth2 Gateway ->> OAuth2 Gateway: Validate:\n- not revoked\n- status == 'completed'
     22             
     23             alt Invalid token state
     24                 OAuth2 Gateway -->> Client: 401 UNAUTHORIZED \n{error: 'invalid_token'}
     25             else Valid token and VC available
     26                 OAuth2 Gateway -->> Client: 200 OK \n{verifiable_credential}
     27             end
     28         end
     29     end