Spring セキュリティのデフォルト フィルターをオーバーライドしたい。私が本当にやりたいことは、ユーザーがインデックスページにアクセスする権限を持っているかどうかをスプリングセキュリティがチェックし、そうでない場合、スプリングセキュリティがページをログインにリダイレクトすることです。この応答をオーバーライドしたい。とにかくこれを行うことはありますか?
編集: Spring セキュリティ フィルターが ajax 応答を返すため、ページが動かなくなり、ログイン ページにリダイレクトされません。私がやりたいのは、このフィルターをオーバーライドすることです。
私の spring-security.xml
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http auto-config='false' use-expressions="true">
<intercept-url pattern="/login*" access="permitAll"/>
<intercept-url pattern="/ajaxErrorPage" access="permitAll"/>
<intercept-url pattern="/pages/*" access="hasRole('admin')" />
<intercept-url pattern="/j_spring_security_check" access="permitAll"/>
<logout logout-success-url="/login.xhtml" />
<form-login login-page="/login.xhtml"
login-processing-url="/j_spring_security_check"
default-target-url="/pages/index.xhtml"
always-use-default-target="true"
authentication-failure-url="/login.xhtml"/>
</http>
<!--Authentication Manager Details -->
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="customUserDetailsService">
<!-- <password-encoder hash="md5"/>-->
</authentication-provider>
</authentication-manager>
</beans:beans>