Ich habe festgestellt, dass zu diesem Thema ein paar Fragen gestellt werden. Ich habe sie durchgesehen und konnte sie nicht auf mein spezifisches Spring-Setup anwenden. Ich möchte meine Login-Weiterleitung basierend auf der Rolle des Benutzers als bedingt konfigurieren. Das ist, was ich habe, so weit:Spring Security konditional default-target-url
<http auto-config="true" use-expressions="true">
<custom-filter ref="filterSecurityInterceptor" before="FILTER_SECURITY_INTERCEPTOR"/>
<access-denied-handler ref="accessDeniedHandler"/>
<form-login
login-page="/login"
default-target-url="/admin/index"
authentication-failure-url="/index?error=true"
/>
<logout logout-success-url="/index" invalidate-session="true"/>
</http>
Ich dachte this question in der gleichen Linie sein könnte als das, was ich zu tun bin versucht. Weiß jemand wie ich es anwenden kann?
EDIT 1
<bean id="authenticationProcessingFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationSuccessHandler" ref="authenticationSuccessHandler"/>
</bean>
<bean id="authenticationSuccessHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="/login.jsp"/>
</bean>
EDIT 2
Zur Zeit habe ich keine Klasse wie public class Test implements AuthenticationSuccessHandler {}
wie in this example gezeigt.
Ihre Frage ist identisch mit [diesem] (http://stackoverflow.com/questions/7470405/authenticationsuccesshandler-example-for-spring-security-3) –
Danke. Könnten Sie bitte ** EDIT 1 ** überprüfen. Ich bin verwirrt, weil ich dieser Bohne bereits eine Federklasse zuordne? – ThreaT
Hat sich ein authenticationSuccessHandler nicht formlogin? http://static.springsource.org/spring-security/site/docs/3.0.x/reference/appendix-namespace.html –