Announcement Announcement Module
Collapse
No announcement yet.
loadUserByUsername method is never called Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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.

      Comment


      • #4
        Make sure you are using a POST to submit your credentials. If that isn't it provide your logs and login page.

        Comment


        • #5
          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.

          Comment

          Working...
          X