Secure Web Api called by PhoneGap application

天大地大妈咪最大 提交于 2019-12-06 16:36:24

Well I am also searching into this and what I have got so far i will share with you in following steps:-

1) Whenever user call my login page I will create the token in response header to make sure that request is coming from legitimate user. just like antiforgery token in mvc.

2) Then upon successful login i will create the authentication cookie and set the current user context value this will Authorize the user and generate another token as mentioned above.

3)Then after this i will use normal Authorise, Roles attribute provided by WEBApi.

Let me know what you think? I am more than happy to contribute.

Another approach is when user login create a hashed token and add it to response header and create custom attribute which grab that token and check it against the database. The problem with this approach is that you will be hammering ur database all the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!