我们的应用程序具有成功登录的自定义成功处理程序.它基本上将它们重定向到会话到期时它们所在的页面.
我们正在转向Java配置而不是spring xml配置.配置的其余部分非常顺利,但是我们找不到将security:form-login标记的authentication-success-handler-ref属性放在哪里.
<security:http auto-config='true'>
...
<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY"/>
<security:form-login login-page="/login" default-target-url="/sites"
authentication-failure-url="/login"
authentication-success-handler-ref="authenticationSuccessHandler"/>
...
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是我们的配置.
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login")
.and()
.logout()
.permitAll()
.and()
}
Run Code Online (Sandbox Code Playgroud)
此外,我们找不到将default-target-url放在哪里,但这绝对不那么重要.
警告,我们实际上使用的是Groovy,但代码与Java配置基本相同.