【发布时间】:2013-02-03 13:47:24
【问题描述】:
问题:当我在 Web 服务方法中添加 @Secured 注释时,端点被禁用意味着我在调用 ws 端点时得到 No endpoint mapping found 错误。
背景:我的 Spring Web Service 可以使用 UsernameToken 和 Timestamp 对消费者进行安全验证,这在我添加 @Secured 以强制执行基于角色的授权之前工作得非常好。拦截器使用
- spring ws:2.0.5.RELEASE
- spring ws 安全性:2.0.5.RELEASE
- spring 安全性:3.0.7.RELEASE
- wss4j:1.5.12
这是我正在尝试做的示例。
端点:
...
@Endpoint
public class XYZEndpoint implements XYZService{
@Override
@PayloadRoot(localPart = XYZ_REQUEST, namespace = NAMESPACE_XYZ)
//@Secured({"ROLE_XYZ"})
public XYZResponse produceXYZ(XYZRequest request) {
...
return new XYZResponse();
}
}
...
我正在使用下面的 global-method-security 来启用 @Secured 注释,如 spring 文档所述。
spring-ws-servlet.xml
...
<security:global-method-security secured-annotations="enabled" />
....
【问题讨论】:
-
你试过用soapaction代替payload吗?
-
这是典型的 Spring 问题,具有 自动检测处理程序 和 基于方面的功能,例如
@Secured或@Transactional。 -
我想通了。我使用抽象类而不是接口来让@Secured 工作。
标签: authentication soap spring-security authorization spring-ws