juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.02k stars 1.19k forks source link

feat(users): add endpoint for terminate auth select #5135

Closed apoorvdixit88 closed 6 days ago

apoorvdixit88 commented 6 days ago

Type of Change

Description

Additional Changes

Motivation and Context

Closes #5127

How did you test it?

If request from id that has auth type as open_id_connect:

curl --location 'http://localhost:8080/user/auth/select' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT' \
--header 'Cookie: Cookie_1=value' \
--data '{
    "id":"f20742d2-f1b8-4dad-8b2d-cf8fe6d457eb"

}'

response will contain token type as sso

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYjJkNjMxZDUtMGQzMi00Y2IxLTg2MTQtNWVlNWI2MDczYTVkIiwicHVycG9zZSI6InNzbyIsIm9yaWdpbiI6ImFjY2VwdF9pbnZpdGF0aW9uX2Zyb21fZW1haWwiLCJwYXRoIjpbImF1dGhfc2VsZWN0Il0sImV4cCI6MTcxOTU4NDc2NX0.ChD9An8L4szVjLn9Q51otVOXOuZf8kdgRMmH865lQQI",
    "token_type": "sso"
}

If request from id other than open_id_connect

curl --location 'http://localhost:8080/user/auth/select' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SPT' \
--header 'Cookie: Cookie_1=value' \
--data '{

    "id":"65ff02eb-f3dc-4afc-b8ac-cef2a30c4d12"

}'

Response will contain token type as totp

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYjJkNjMxZDUtMGQzMi00Y2IxLTg2MTQtNWVlNWI2MDczYTVkIiwicHVycG9zZSI6InRvdHAiLCJvcmlnaW4iOiJhY2NlcHRfaW52aXRhdGlvbl9mcm9tX2VtYWlsIiwicGF0aCI6WyJhdXRoX3NlbGVjdCJdLCJleHAiOjE3MTk1ODQ5MDl9.hEBp49fycxiSW1VoyPR6s9TISO4lQKP3ta0S4SH3C9s",
    "token_type": "totp"
}

Db entries for correponding request ids: Screenshot 2024-06-26 at 7 59 41 PM

Checklist