我已经为RESTful Web服务项目实现了Spring Security。它具有具有相同网址格式但具有不同请求方法类型的请求映射。
才能执行,但是我需要删除@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 }
当前所有这些方法都需要Authorization
createAccount(...)
方法的授权。是否有基于注释的解决方案?注意:
我需要一个不会对URL模式进行更改的解决方案,因为它将影响许多其他模块。我已经为RESTful Web服务项目实现了Spring Security。它具有具有相同网址格式但具有不同请求方法类型的请求映射。 @RequestMapping(value =“ / charity / ...
下面是一个示例配置,该配置将允许请求signup
和about
:
这就是我们拥有角色,授权的原因。首先,我们可以定义谁可以进行GET / PUT / POST并相应地向用户授予权限。