开发者

Spring/Acegi security for REST Webservices in WebApplication?

开发者 https://www.devze.com 2023-02-25 01:07 出处:网络
Our current app is a standard spring 2.5 application with Form Based Authentication using Acegi. However, we need to expose some REST Service for 3rd party application and we are trying to use BASIC a

Our current app is a standard spring 2.5 application with Form Based Authentication using Acegi. However, we need to expose some REST Service for 3rd party application and we are trying to use BASIC auth over SSL. We have used RESTEAsy for exposing the REST Services. Now, given that the rest of the application uses form & Session based authentication, how can I enable basic authentication for the few REST Services.

To me, the usecase seems normal, however, I couldn't 开发者_JAVA技巧find much reference on the web. Any comment/suggestions will be very much appreciated.


Regarding the more general question of whether to secure the REST service using Form authentication or Basic/Digest authentication - this is deeply tied into one of the more important constraints of RESTful architecture - statelessness.

With this in mind, logging into a service means keeping state on the server, which goes against the stateless server constraint. From an authentication POV, Form based authentication implies logging in, whereas Basic/Digest authentication means embedding the authentication credentials in each request, with no need to keep any state on the server. This is why this kind of authentication is much more inline with the way REST is meant to be build.

Hope this helps.


Check out Basic/Digest Authentication in the Spring Security Reference.

0

精彩评论

暂无评论...
验证码 换一张
取 消