adorsys / open-banking-gateway

Provides RESTful API, tools, adapters, and connectors for transparent access to open banking API's (for banks that support PSD2 and XS2A as well as HBCI/FinTS)
https://adorsys.github.io/open-banking-gateway
GNU Affero General Public License v3.0
255 stars 95 forks source link

Redirect after Consent is retrieved #384

Closed electronicpeter closed 4 years ago

electronicpeter commented 4 years ago

Today (12.3.2020) we (Hergy, Roman, Valentyn and Peter) agreed that redirect after Consent will work like this:

1) after Call listAccounts(1a) was done from fintechUI, and tpp answers with missing content and redirect, redirect is done from fintechUI to given location.

2) before this, fintechServer get fintechRedirectOKURL from header field. This URL will look like /bank//redirecttransaction This redirectURL is changed from fintech server with a prefix given in the propertyfile of the fintechserver and appended with the /{redirectcode} So the path might look like: http://localhost:4444/bank/53c47f54-b9a4-465a-8f77-bc6cd5f0cf46/redirectaccount/12345

3) eventually this url is called. When browser gets urls, hopefully UI Session is recovered automaticly. So XSRF-Token should be known.

4) Now FintechUI has to call GET /v1/1/fromConsentOk/{xsrf-token}?{redirectCode=redirectCode}

Fintech Server now can recover from xsrf-Token what was called (e.g. listAccounts, or any other service) and redoes the the call which was done in step a), but now with the sessionID so that backend can retrieve consent. Eventually this GET returns the accounts.

If other services were used (e.g. listTransactions or initatePayment) the okurls given by the frontend would look differently like: /bank//redirecttransaction/ /bank//redirectpayment/???

TODO in Frontend:

1) create correct redirect url 2) creaate route that listenes to this url (including the appended redirect code) 3) call backend with redirect call addding xsrftoken and redirect code 4) retrieve result and show like list accounts

DG0lden commented 4 years ago

Protocol out of the discussion (TODOs):

Note: For payments successful matching on TPP server of these parameters is a trigger for payment confirmation call to bank.

Further TODOs (for a separate task) - handle XSRF Token correctly

electronicpeter commented 4 years ago

LoA Introduction: .................

LoA-030 : FinTechApi.listOfAccounts ...................................

LoA-031 : FinTechApi.checkAuthorization .......................................

LoA-032 : FinTechApi.userAgentContext .....................................

LoA-033 : FinTechApi.buildUrlTemplates ......................................

LoA-034 : FinTechApi.loadServiceSession .......................................

LoA-040 : TppBankingApi.listOfAccounts ......................................

LoA-076 TppBankingApi:303_SeeOther ..................................

LoA-078 FinTechApi.expireSessionCookie(SessionCookie) .....................................................

Upon redirecting the PSU user agent to the ConsentAuthorizationApi, the regular session between the FinTechUI and the FinTechApi has to be removed

LoA-079 FinTechApi.createRedirectCookie .......................................

LoA-080 : FinTechApi redirects userAgent to the ConsentAuthorisationApi .......................................................................

The service response carries a response code 302 instructing the FinTechUI to redirect the PsuUserDevice to the ConsentAuthorisationApi, with following information: - redirectCode : attached as a query parameter - SessionCookie : for deletion - RedirectCookie : with the expected duration of the consent authorization.

LoA-090 Suitable Consent Present ................................

InitConsent-010 ConsentAuthorisationApi .......................................