我有一个 Spring-MVC 应用程序,我希望在其中有一个显示在多个页面上的登录栏 - 并使用 jQuery 的对话框系统在模式对话框窗口中显示表单。我应该在 securityContext.xml
中使用什么 Spring-Security 设置为了这个工作?
这是我目前使用的:
<http pattern="/resources/**" security="none" />
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/redirect.jsp" access="permitAll" />
<intercept-url pattern="/*.html" access="permitAll" />
<intercept-url pattern="/**" access="denyAll" />
<form-login login-page="" />
<logout logout-success-url="/logout" />
</http>
最佳答案
从每个页面登录是另一种说法,即该应用程序没有任何入口点。所以我们需要配置一个什么都不做的入口点。
我们可以这样做:
public class DoNothingEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
throws IOException, ServletException {
/* do nothing */
}
}
in XML:
<beans:bean id="doNothingEntryPoint" class="xyz.package.DoNothingEntryPoint" />
<http entry-point-ref="doNothingEntryPoint" use-expressions="true">
....
关于Spring-security 如何从每个页面登录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15658956/