大佬教程收集整理的这篇文章主要介绍了将Spring Security移至Java Config,authentication-success-handler-ref会去哪儿?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
所有设置都可以在全局configure方法内完成。添加以下内容:
@OverrIDe
protected voID configure(httpSecurity http) throws Exception {
http
.authorizerequests()
.anyrequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultsuccessUrl("/sites")
.failureUrl("/login")
.successHandler(yoursuccessHandlerBean) // autowired or defined below
.and()
.logout()
.permitAll()
.and()
}
@R_305_9616@程序具有用于成功登录的自定义成功处理程序。基本上,它们会将他们重定向到会话过期时所在的页面。
我们将转向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"/>
...
到目前为止,这是我们的配置。
@Override
protected void configure(httpSecurity http) throws Exception {
http
.authorizerequests()
.anyrequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login")
.and()
.logout()
.permitAll()
.and()
}
另外,我们找不到默认目标网址的放置位置,但这绝对不那么重要。
请注意,我们实际上是在使用Groovy,但是代码基本上与Java配置相同。
以上是大佬教程为你收集整理的将Spring Security移至Java Config,authentication-success-handler-ref会去哪儿?全部内容,希望文章能够帮你解决将Spring Security移至Java Config,authentication-success-handler-ref会去哪儿?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。