简体   繁体   中英

@Secured service methods and spring ws

I have the following project structure:

base project (service layer, model) web project webservice project

where both the web project and the web service project depend on the base project and use services provided by it.

I make heavy use of the Spring Framework which means the Services are Spring Beans with methods secured by the @Secured Annotation and Spring Security . I created an Voter extending the AbstractAclVoter that checks client permissions.

The web project uses Spring MVC and the web service project Spring WS with @Endpoint Annotations and the XwsSecurityInterceptor .

Here is my problem:

The permissions are checked if a call comes from a web project controller or in JUnit tests of the base project but requests from the web service project are not checked for the correct permission - my Voter is not called!

  • Has this something to do with the XwsSecurityInterceptor ?
  • Do I need the DelegatingFilterProxy in the web service project too? (I have no ContextLoaderListener there because everything is configured by the MessageDispatcherServlet config)

Your user authentication object with populated Granted Authority is available only in the web context not in your web services project. When you make a call to your web service application, you don't have the same security context over there. So your security tags won't work over there.

Spring Security integrates as a servlet filter in the web application. So I would assume that the DelegatingFilterProxy will need to be added to web.xml for the web services project so that it can process the requests going to that application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM