123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #//# --------------------------------------------------------------------------------------
- #//# Created using Sequence Diagram for Mac
- #//# https://www.macsequencediagram.com
- #//# https://itunes.apple.com/gb/app/sequence-diagram/id1195426709?mt=12
- #//# --------------------------------------------------------------------------------------
- title "How to Create GateToken and Use for Api23-App Service"
- participant App_Origin as origin
- participant Frontend_Laravel as frontend
- participant Laravel_env as dotenv
- participant Backend_Golang as backend
- participant MemoryDB as bunt_db
- participant SsoServer as sso_svr
- activate origin
- activate frontend
- origin->frontend: request /api23-app \n Api23Key @HtmHeader, \n Json @htmBody
- frontend<->backend: /gate-token-get Process
- note over frontend, backend
- response _{GateToken}
- end note
- frontend->origin: response 200 \n %{GateToken}
- #alt [if AppType=app]
- # frontend->origin: response 200 \n %{GateToken}
- #end
- deactivate frontend
- origin->backend: request directly regular Dabory API \n %Gatetoken@htmHeader, Json @htmBody
- backend->origin: response API result
- deactivate frontend
- deactivate origin
- == /gate-token-get Process ==
- activate frontend
- frontend->frontend: get ClientId @.env.dabory, \nReferer@HtmHeader
- dotenv-> frontend: get ClientId@.env.dabory, \n Api23eKeyPair@.env
- activate backend
- frontend->backend: request /gate-token-get \n %{ClientId, BB64, Api23Key, Api23eKeyPair}, \n Referer @HtmHeader
- activate sso_svr
- backend->sso_svr: request /key-pair-get %{ClientID}
- sso_svr->backend: respond {KeyPair}
- deactivate sso_svr
- backend->backend: decrypt #Api23KeyPair \n %Api23eKeyPair, KeyPair
- backend->backend: decrypt Api23KeyBase \n %Api23key, Api23KeyPair \n\n *Api23KeyBase consists \n {ClientId, OriginUrl, \n AppType,SsoSubId}(j)
- alt
- note over backend
- if_ClientId@HtmHeader != ClientId (1) \n
- or_Referer@HtmHeader != OriginUrl (2) \n
- * (2) is NOT for native-app
- end note
- backend->frontend: response 505
- end
- backend->backend: create a GateToken
- backend->backend: decrypt GateTokenBase \n %(BB64, KeyPair) \n\n * GateTokenBase consists \n {DBconn-Info, SsoSubId}(j)
- backend->bunt_db: save GateTokenBase @GateToken
- alt [if AppType=js]
- backend->bunt_db: save GateToken@Api23Hash \n\n *Api23Hash indicates GateToken \n which is used to find GateToken \n in /gate-token-api23hash-get
- end
- backend->frontend: response 200 \n{GateToken}
- deactivate frontend
|