【发布时间】:2015-12-07 14:52:45
【问题描述】:
我已经为一个 RESTful Web 服务项目实现了 Spring Security。它具有具有相同 url 模式但具有不同请求方法类型的请求映射。
@RequestMapping(value = "/charity/accounts", method = RequestMethod.POST)
public AccountResponseDto createAccount(HttpServletResponse response, @RequestBody AccountRequestDto requestDTO) {
// some logics here
}
@RequestMapping(value = "/charity/accounts", method = RequestMethod.GET)
public AccountResponseDto getAccount(HttpServletResponse response) {
// some logics here
}
@RequestMapping(value = "/charity/accounts", method = RequestMethod.PUT)
public void updateAccount(HttpServletResponse response, @RequestBody AccountRequestDto requestDTO){
// some logics here
}
目前所有这些方法都需要授权才能执行,但我需要删除createAccount(...) 方法的授权。是否有基于注释的解决方案?
注意:我需要一个不会影响对 url 模式进行更改的解决方案,因为它会影响许多其他模块。
【问题讨论】:
-
发布您的安全配置!!
标签: java spring spring-mvc spring-security spring-annotations