Detail about CSRF token fetch request

138 阅读1分钟

Created by Jerry Wang, last modified on Jun 17, 2015

  • updateSecurityToken
  • bTokenHandling
  • x-csrf-token
  • oServiceData.securityToken
  • ODataModel._createBatchRequest
  • ODataModel.prototype.refreshSecurityToken

clipboard1

clipboard2

Who has started this csrf token request? It is automatically done by oDataModel framework.

clipboard3

 

Now we know that everytime an HTTP post request is sent, the token will be forced to fresh from backend.

 

So it means it will not be repeatedly called every time we select another item in navigation list.

clipboard4

And by default, all oData instance should have set this flag as true, which could be observed in constructor.

clipboard5

And by default, all oData instance should have set this flag as true, which could be observed in constructor.

clipboard6

clipboard7\

\

Created by Jerry Wang, last modified on Jul 22, 2015

  • updateSecurityToken
  • Security
  • Token
  • x-csrf-token
  • bTokenHandling
    以opportunity为例:

clipboard1

如果token不available,就发Odata request到后台去取:
clipboard2

问题:this.bTokenHandling什么时候置为true?

在ODataModel的构造函数里。

clipboard3
clipboard4