首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >关于OData modifying请求需要事先提供CSRF token 的讨论

关于OData modifying请求需要事先提供CSRF token 的讨论

作者头像
Jerry Wang
发布2019-06-25 10:14:40
6800
发布2019-06-25 10:14:40
举报

I have made some search in the internet and it seems the CSRF token mechanism is not just applied to OData, but a generic approach to prevent exposed HTTP resources from CSRF attack, for example the idea is also applied in the good-old ASP MVC application which has nothing to do with OData.

https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/preventing-cross-site-request-forgery-csrf-attacks

https://issues.oasis-open.org/browse/ODATA-262

In SAP implementation, the CSRF token is generated and maintained in so called “security context” managed by ABAP Netweaver:

clipboard1
clipboard1
clipboard2
clipboard2

First the current session ID is retrieved by function TH_GET_SECURITY_CONTEXT_REF: 04D8A63F901811E9ABAD02000A212071

clipboard3
clipboard3

Then the associated context is retrieved by this session ID via cl_http_security_session_admin=>get_associated_contexts. The token is one part of context.

clipboard4
clipboard4

In this aspect our OData is not stateless, I agree with you. It’s disappointing that we have to explicitly request token in our nodejs/java/ABAP program, however in UI5 aspect, the UI developer needn’t to handle with it manually:

clipboard5
clipboard5

https://openui5.hana.ondemand.com/#/api/sap.ui.model.odata.ODataModel/methods/getSecurityToken

clipboard6
clipboard6
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年06月24日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档