我有一个使用 Spring 3.* 的 Web 应用程序,我的 Web 应用程序中有一个 Flash 组件,需要 POST 到 Servlet。 在 Servlet 的 doPost 方法中,我想检查 Spring 应用程序上下文以确保有一个经过身份验证的会话,这可能吗?
嗯,这很简单,只需使用
Authentication auth = SecurityContextHolder.getContext().getAuthentication();