kych

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

authorize_sequence.txt (2122B)


      1 sequenceDiagram
      2     participant Client
      3     participant OAuth2 Gateway
      4     participant OAuth2 Gateway DB
      5     participant Swiyu Verifier
      6     
      7     Client ->> OAuth2 Gateway: GET /authorize?\nresponse_type=code&\nclient_id={client_id}&\nnonce={nonce}
      8     
      9     OAuth2 Gateway ->> OAuth2 Gateway: Validate parameters:\n- response_type == 'code'
     10     
     11     alt Invalid parameters
     12         OAuth2 Gateway -->> Client: 400 BAD REQUEST\n{error: 'invalid_request'}
     13     else Valid parameters
     14         OAuth2 Gateway ->> OAuth2 Gateway DB: UPDATE verification_sessions s \nSET status = s.status \nFROM clients c \nWHERE s.client_id = c.id \nAND s.nonce = $1 AND c.client_id = $2 \nRETURNING s.id, s.status, s.expires_at, \ns.scope, s.verification_url, \ns.request_id, s.verifier_nonce, \nc.verifier_url, c.verifier_management_api_path
     15         
     16         OAuth2 Gateway DB -->> OAuth2 Gateway: Query result
     17     end
     18     
     19     alt Session error
     20         OAuth2 Gateway -->> Client: Error Response:\n- 404 NOT FOUND (session not found)\n- 410 GONE (expired)\n- 409 CONFLICT (not pending)
     21     else Session already authorized (idempotent)
     22         OAuth2 Gateway -->> Client: 200 OK \n{verification_id, verification_url}
     23     else Session valid and pending - proceed
     24         OAuth2 Gateway ->> OAuth2 Gateway: build_presentation_definition(scope)
     25         
     26         OAuth2 Gateway ->> Swiyu Verifier: POST /management/api/verifications \n{presentation_definition, response_mode, ...}
     27         Swiyu Verifier -->> OAuth2 Gateway: Response
     28         
     29         alt Error
     30             OAuth2 Gateway -->> Client: Error Response:\n- 502 BAD GATEWAY (verifier error)\n- 500 INTERNAL SERVER ERROR (DB error)
     31         else Success
     32             OAuth2 Gateway ->> OAuth2 Gateway DB: UPDATE verification_sessions \nSET verification_url = $1, request_id = $2, \nverifier_nonce = $3, status = 'authorized', \nauthorized_at = NOW() \nWHERE id = $4 \nRETURNING verification_url, request_id
     33             
     34             OAuth2 Gateway DB -->> OAuth2 Gateway: Updated session
     35             OAuth2 Gateway -->> Client: 200 OK \n{verification_id, verification_url}
     36         end
     37     end