日期:2014-05-16  浏览次数:20998 次

acegi集成遇到的问题:HTTP Status 403 - Access is denied
acegi集成后,如果用户没有权限访问某个url,会默认跳转到403错误。提示“HTTP Status 403 - Access is denied”。这样用户体验度不好,可以修改为没有权限时,跳转到一个错误提示页面,或者跳转到登录页面。修改如下配置:

<!-- 发生验证错误或权限错误时的处理 -->
    <bean id="exceptionTranslationFilter"
        class="org.acegisecurity.ui.ExceptionTranslationFilter">
        <property name="authenticationEntryPoint">
            <bean
                class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
                <property name="loginFormUrl" value="/acegilogin.jsp" />
                <property name="forceHttps" value="false" />
            </bean>
        </property>
        <property name="accessDeniedHandler">
            <bean
                class="org.acegisecurity.ui.AccessDeniedHandlerImpl">


                <!--       <property name="errorPage" value="/protected/accessDenied.jsp"/> -->

                <!-- HTTP Status 403 - Access is denied -->
            </bean>
        </property>
    </bean>