开发者

Cannot find a jsp view when spring security is applied

开发者 https://www.devze.com 2023-03-26 06:35 出处:网络
I have a java + spring web application and spring security 3.0 is applied to it. Using the security intercept url I\'m trying to apply none filter to a particular view (jobs.jsp) however when I reque

I have a java + spring web application and spring security 3.0 is applied to it. Using the security intercept url I'm trying to apply none filter to a particular view (jobs.jsp) however when I request for that url the request mapping works, but returning t开发者_如何学Gohe view (ModelAndView as jobs.jsp) does not work.

It gives me an error saying that could not found /WEB-INF/view/jobs.jsp , however the file is right there.

I think the spring security does not allow this resource to be accessed unless authenticated?

<security:http auto-config="true" use-expressions="true">
 <security:intercept-url pattern="/**" access="hasRole('admin')" />
 <security:intercept-url pattern="/resources/static/login.html" filters="none"/>
 <security:intercept-url pattern="/resources/static/home.html" filters="none"/>
 <security:intercept-url pattern="/home/*" filters="none"/>
 <security:intercept-url pattern="/job/all/*" filters="none"/>

 <security:intercept-url pattern="/resources/css/*" filters="none"/>
 <security:intercept-url pattern="/resources/js/*" filters="none"/>
 <security:intercept-url pattern="/resources/images/*" filters="none"/>

 <security:form-login login-page ="/resources/static/login.html"
                      authentication-failure-url="/resources/static/login.html"/>    
<security:logout logout-url="/logout"
                 logout-success-url="/resources/static/home.html"/>


The order of intercept url's caused the problem. This one works.

<security:intercept-url pattern="/job/all/*" access="isAnonymous()"/>
<security:intercept-url pattern="/**" access="hasRole('admin')" />
0

精彩评论

暂无评论...
验证码 换一张
取 消