Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
访问Spring Security';s FormLoginBeanDefinitionParser';AuthenticationSuccessHandler实现中的s属性_Authentication_Spring Security_Servlet Filters - Fatal编程技术网

访问Spring Security';s FormLoginBeanDefinitionParser';AuthenticationSuccessHandler实现中的s属性

访问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

我想在AuthenticationSuccessHandler实现中访问表单登录标记的配置属性

示例情况如下所示:

@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();     
}