あなたはこのような何か行うことができます:XMLの設定で
public class Test implements AuthenticationSuccessHandler {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
Set<String> roles = AuthorityUtils.authorityListToSet(authentication.getAuthorities());
if (roles.contains("ROLE_USER") {
response.sendRedirect("/userpage");
}
}
}
この追加:OK、と春・セキュリティに
<bean id="authenticationFilter" class="YOUR_AUTH_FILTER_HERE">
<!-- There might be more properties here, depending on your auth filter!! -->
<property name="authenticationSuccessHandler" ref="successHandler" />
</bean>
<bean id="successHandler" class="Test"/>
を。 xml、どのように私はこのカスタムハンドラ(テスト)を含めることができます – Vivek
私はそれに応じて私の答えを更新しました。 – nfechner
ありがとうございました。それは魅力のように働いた:) – Vivek