我有GWT Spring安全3.2.0应用程序,在war文件中我有上传/图像/文件夹。
如果用户尝试访问任何图片文件夹或上传文件,我如何将用户重定向到主页?
<http auto-config="true">
<intercept-url pattern="/greet/**" access="ROLE_USER" />
<intercept-url pattern="/gwt/**" access="ROLE_USER" />
<intercept-url pattern="/" access="ROLE_USER" />
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/images/**" access="IS_AUTHENTICATED_FULLY"/>
<intercept-url pattern="/uploads/**" access="IS_AUTHENTICATED_FULLY"/>
<form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=true" />
</http>
由于
答案 0 :(得分:0)
您应该重新排序定义并将/ **模式作为最后一个:
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/greet/**" access="ROLE_USER" />
<intercept-url pattern="/gwt/**" access="ROLE_USER" />
<intercept-url pattern="/" access="ROLE_USER" />
<intercept-url pattern="/images/**" access="denyAll()"/>
<intercept-url pattern="/uploads/**" access="denyAll()"/>
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=true" />
</http>