api23-gate-token-app.msd 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #//# --------------------------------------------------------------------------------------
  2. #//# Created using Sequence Diagram for Mac
  3. #//# https://www.macsequencediagram.com
  4. #//# https://itunes.apple.com/gb/app/sequence-diagram/id1195426709?mt=12
  5. #//# --------------------------------------------------------------------------------------
  6. title "How to Create GateToken and Use for Api23-App Service"
  7. participant App_Origin as origin
  8. participant Frontend_Laravel as frontend
  9. participant Laravel_env as dotenv
  10. participant Backend_Golang as backend
  11. participant MemoryDB as bunt_db
  12. participant SsoServer as sso_svr
  13. activate origin
  14. activate frontend
  15. origin->frontend: request /api23-app \n Api23Key @HtmHeader, \n Json @htmBody
  16. frontend<->backend: /gate-token-get Process
  17. note over frontend, backend
  18. response _{GateToken}
  19. end note
  20. frontend->origin: response 200 \n %{GateToken}
  21. #alt [if AppType=app]
  22. # frontend->origin: response 200 \n %{GateToken}
  23. #end
  24. deactivate frontend
  25. origin->backend: request directly regular Dabory API \n %Gatetoken@htmHeader, Json @htmBody
  26. backend->origin: response API result
  27. deactivate frontend
  28. deactivate origin
  29. == /gate-token-get Process ==
  30. activate frontend
  31. frontend->frontend: get ClientId @.env.dabory, \nReferer@HtmHeader
  32. dotenv-> frontend: get ClientId@.env.dabory, \n Api23eKeyPair@.env
  33. activate backend
  34. frontend->backend: request /gate-token-get \n %{ClientId, BB64, Api23Key, Api23eKeyPair}, \n Referer @HtmHeader
  35. activate sso_svr
  36. backend->sso_svr: request /key-pair-get %{ClientID}
  37. sso_svr->backend: respond {KeyPair}
  38. deactivate sso_svr
  39. backend->backend: decrypt #Api23KeyPair \n %Api23eKeyPair, KeyPair
  40. backend->backend: decrypt Api23KeyBase \n %Api23key, Api23KeyPair \n\n *Api23KeyBase consists \n {ClientId, OriginUrl, \n AppType,SsoSubId}(j)
  41. alt
  42. note over backend
  43. if_ClientId@HtmHeader != ClientId (1) \n
  44. or_Referer@HtmHeader != OriginUrl (2) \n
  45. * (2) is NOT for native-app
  46. end note
  47. backend->frontend: response 505
  48. end
  49. backend->backend: create a GateToken
  50. backend->backend: decrypt GateTokenBase \n %(BB64, KeyPair) \n\n * GateTokenBase consists \n {DBconn-Info, SsoSubId}(j)
  51. backend->bunt_db: save GateTokenBase @GateToken
  52. alt [if AppType=js]
  53. backend->bunt_db: save GateToken@Api23Hash \n\n *Api23Hash indicates GateToken \n which is used to find GateToken \n in /gate-token-api23hash-get
  54. end
  55. backend->frontend: response 200 \n{GateToken}
  56. deactivate frontend