Results 1 to 5 of 5

Thread: loadUserByUsername method is never called

  1. #1
    Join Date
    Apr 2010
    Posts
    5

    Default loadUserByUsername method is never called

    This is my configuration

    <http use-expressions="true" auto-config="false">
    <intercept-url pattern="/login" access="permitAll" />
    <intercept-url pattern="/resources/**" filters="none" />
    <intercept-url pattern="/**" access="isAuthenticated()" />
    <form-login always-use-default-target="true" login-page="/login"
    authentication-failure-url="/login?error=true" />
    <logout invalidate-session="true" />
    </http>

    <authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="userService" />
    </authentication-manager>
    <beans:bean id="userService" class="com.example.service.UserServiceImpl"></beans:bean>

    But method loadUserByUsername is never called. Can somebody help me? I use spring security 3.0.5.RELEASE version.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    What are you doing to try to get it to be called? How are you validating it is not called? Have you tried turning on logging for Spring Security? What do the logs look like?

    PS: when posting configuration, logs, code, etc please use code tags (i.e. the # button) to make it easier for others to read
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3
    Join Date
    Apr 2010
    Posts
    5

    Default

    Well I'm trying to configure basic scenario to login. I have standard spring login page. I submit login information to j_spring_security_check. No errors in console, and I've always been redirected to login error page. It just won't authenticate the user, or even try (I check it in debug mode). I use implementation of UserDetailService as an authentication provider and it's loadUserByUsername method never get called. I haven't tried to turn logging for spring security, I will do that.

  4. #4
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    Make sure you are using a POST to submit your credentials. If that isn't it provide your logs and login page.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  5. #5
    Join Date
    Apr 2010
    Posts
    5

    Default

    I turned on spring security debug logging and I got answer. I was sending GET request and only POST is supported. It it works perfectly now.
    You where right. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •