我的服务代码如下...
@Controller
@GwtRpcEndPoint
public class ServerServiceImpl implements ServerService {
@org.springframework.security.annotation.Secured("ROLE_ADMIN")
public String runGwtSprMvcHibJpaDemo(String s) {
System.out.println("SecurityContextHolder.getContext()="+SecurityContextHolder.getContext());
System.out.println("SecurityContextHolder.getContext().getAuthentication()="+SecurityContextHolder.getContext().getAuthentication());
}
}
我的 applicationContext.xml
<security:global-method-security secured-annotations="enabled" jsr250-annotations="disabled" />
但是当我通过 gwt-rpc 调用 serviceImpl 时,由于用户尚未通过身份验证,runGwtSprMvcHibJpaDemo 是否应该打印出安全错误?相反,runGwtSprMvcHibJpaDemo 方法是通过输出执行的
SecurityContextHolder.getContext()=org.springframework.security.context.SecurityContextImpl@ffffffff: Null authentication SecurityContextHolder.getContext().getAuthentication()=null