How to redirect access denied page in spring security?

I want to know how to redirect spring access denied page? Should I use any handler or edit in web.xml?

thank

+5
source share
3 answers

Have you read the relevant sections of the Spring Security Guide, namely AccessDeniedHandler and the namespace application .

If you want more control, you can use

 <http use-expressions="true">
     <intercept-url pattern="/denied/*" access="permitAll" />

     <access-denied-handler error-page="/denied">

     <!-- The rest of your configuration -->
 </http>

Where /denieddisplays the web controller class you are writing. Make sure it is /denied/**not protected.

, , ?

+13

RedirectView

       return new ModelAndView(new RedirectView(request.getContextPath()+ "urlPath"), modelMap);

redirect:.

+1

, , secuirty. , . , . , web.xml.

0

All Articles