0

I am implementing customized MyUsernamePasswordAuthenticationFilter.

I want to configure it my spring security.

<sec:http entry-point-ref="myAuthenticationEntryPoint" create-session="always">
        <sec:form-login login-processing-url="/login" 
                       username-parameter="username" 
                       password-parameter="password" 
              authentication-failure-handler-ref="myAuthenticationFailureHandler" 
              authentication-success-handler-ref="myLoginSuccessHandler" />
 <sec:logout logout-url="/logout" success-handler-ref="myLogoutSuccessHandler"/>        

    <sec:custom-filter ref="myPreAuthFilter" before="PRE_AUTH_FILTER"/>
    <sec:custom-filter ref="myFirstFilter" before="LAST"/>
  </sec:http>

How do I change this to support my new customized filer.

Patan
  • 17,073
  • 36
  • 124
  • 198
  • The process is basically as explained in the [reference manual](http://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#ns-custom-filters). What have you tried? – Shaun the Sheep Nov 15 '13 at 15:11
  • @LukeTaylor. Thank you for response. I have looked at the process. I am not sure how to configure username-parameter and passsword-parameter.Please help. – Patan Nov 18 '13 at 11:57
  • Those parameters only apply to the standard implementation and are passed to the underlying `UsernamePasswordAuthenticationFilter` instance. Since you are using your own class `MyUsernamePasswordAuthenticationFilter` they don't (or may not) apply. Since it's your code, only you can really say what it does. – Shaun the Sheep Nov 19 '13 at 11:39
  • @LukeTaylor. Thanks again for inputs. I am just adding an extra parameter to my request apart from username and password parameters. – Patan Nov 19 '13 at 14:09
  • 1
    Try [this question](http://stackoverflow.com/questions/2483992/spring-security-3-how-to-customize-username-password-parameters/2484817#2484817). It's usually a good idea to search SO for the relevant classnames if you're stuck (which is what I just did). – Shaun the Sheep Nov 19 '13 at 20:16
  • @LukeTaylor. I have implemented it. But I am getting empty SecurityContextHolder.getContext().getAuthentication();. I am not sure if I am missing any thing.http://stackoverflow.com/questions/20095443/getting-empty-or-null-in-username-and-password-in-authentication – Patan Nov 20 '13 at 12:25

0 Answers0