爲我服務的代碼如下...方法@Secured應該拋出錯誤時沒有用戶身份驗證
@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" />
但是當我打電話serviceImpl通過gwt- rpc,沒有運行GwtSprMvcHibJpaDemo應該打印出安全錯誤,因爲用戶還沒有通過身份驗證?相反,該方法runGwtSprMvcHibJpaDemo與輸出
SecurityContextHolder.getContext()[email protected]ff: Null authentication SecurityContextHolder.getContext().getAuthentication()=null