Implementing Security in REST?

跟風遠走 提交于 2019-12-04 16:41:13

Because REST is stateless you cannot use a cookie or session id. It is common to use HTTP Basic Authentication and HTTPS for all requests.

You might want to explore this solution for WCF REST, it is a interceptor for implementing basic authentication with a custom user database.

http://weblogs.asp.net/cibrax/archive/2009/03/20/custom-basic-authentication-for-restful-services.aspx

That interceptor authenticates the user with a password, and initializes the current principal, so you can use that one from the service itself for doing authorization or implement an IAuthorizationManager if you want to have that logic as something reusable across several services.

You will also find some other authentication methods in my blog, like certificate authentication or OAuth, which are less common.

Thanks Pablo.

For authorization, you can look into XACML.

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