【发布时间】:2018-07-27 13:17:34
【问题描述】:
我正在使用@preauthorize 来确保方法级别的安全性。对于我的方法1,两个角色之一只能满足。但是在那个方法中,我需要知道它这次满足了哪个角色,并基于此我需要为功能需求设置后续旅程。我的问题如下 -
@PreAuthorize("hasAnyRole('Role_1') or hasAnyRole('Role_2')")
@RequestMapping(value = URL_MAPPING, method = {RequestMethod.GET, RequestMethod.POST })
public ModelAndView methodName(HttpSession session,
ModelAndView modelAndView) {
//here i need to know which role it has passed to execute the method.
if (role1 executed) {
sessionInformation.updateJourneyInfo(updateforrole1);
}else{
sessionInformation.updateJourneyInfo(updateforrole2);
}
任何人都可以帮助解决这个问题。在此先感谢。
【问题讨论】:
标签: java spring-mvc spring-security roles