CSRF Protection for Refresh Token Cookie in SPA

随声附和 提交于 2019-11-30 13:59:09
tomastrajan

As far as I know the best way to do this is when server renders index.html with the CSFR token inside and after that you function as standard AngularJS SPA. So the index.html is then enriched with CSFR token generated by backend service / framework. SpringSecurity provides nice support for this injecting tokens to the templates.

After that, you can get the token from the template with javascript and set it to all your $http requests in headers by using httpInterceptor's, request hook. (or cookie)? I don't remember clearly whats the proper way but I am sure it is described in articles you mentioned above)

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