访问Spring Security';s FormLoginBeanDefinitionParser';AuthenticationSuccessHandler实现中的s属性
我想在AuthenticationSuccessHandler实现中访问表单登录标记的配置属性 示例情况如下所示:访问Spring Security';s FormLoginBeanDefinitionParser';AuthenticationSuccessHandler实现中的s属性,authentication,spring-security,servlet-filters,Authentication,Spring Security,Servlet Filters,我想在AuthenticationSuccessHandler实现中访问表单登录标记的配置属性 示例情况如下所示: @Autowired private FormLoginBeanDefinitionConfigurationProperties properties; public class CustomAuthenticationSuccessHandler extends SimpleUrlAuthenticationFailureHandler { String usernam
@Autowired
private FormLoginBeanDefinitionConfigurationProperties properties;
public class CustomAuthenticationSuccessHandler extends SimpleUrlAuthenticationFailureHandler {
String usernameParameterName = properties.getUsernameParameter();
String passwordParameterName = properties.getPasswordParameter();
}
当spring安全配置按如下方式配置时:
<security:form-login
login-page="/login.html"
username-parameter="the_username_parameter"
password-parameter="the_password-parameter"
login-processing-url="/dologin"
authentication-success-handler-ref="customAuthenticationSuccessHandler"
authentication-failure-handler-ref="customAuthenticationFailureHandler"
/>
但是类似的事情似乎不可行,因为它是通过AuthenticationConfigBuilder和FormLoginConfiguler反射配置的,并且尝试在应用程序上下文XML中显式定义它将产生另一个UsernamePasswordAuthenticationFilter,它与我所拥有的servlet上下文配置无关设定
欢迎提出任何建议和想法
@Autowired
private UsernamePassworAuthenticationFilter formAuthenticationFilter;
public class CustomAuthenticationSuccessHandler extends SimpleUrlAuthenticationFailureHandler {
String usernameParameterName = formAuthenticationFilter.getUsernameParameter();
String passwordParameterName = formAuthenticationFilter.getPasswordParameter();
}