Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: Can't hit custom AuthenticationProvider

  1. #21
    Join Date
    Jan 2011
    Posts
    27

    Default

    I receive ProviderNotFoundException: No AuthenticationProvider found for org.springframework.security.authentication.Userna mePasswordAuthenticationToken:

    Code:
    17:50:15,937 DEBUG FilterChainProxy:195 - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check'
    17:50:15,937 DEBUG FilterChainProxy:202 - Candidate is: '/j_spring_security_check'; pattern is /js/**; matched=false
    17:50:15,937 DEBUG FilterChainProxy:195 - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check'
    17:50:15,937 DEBUG FilterChainProxy:202 - Candidate is: '/j_spring_security_check'; pattern is /images/**; matched=false
    17:50:15,937 DEBUG FilterChainProxy:195 - Converted URL to lowercase, from: '/j_spring_security_check'; to: '/j_spring_security_check'
    17:50:15,937 DEBUG FilterChainProxy:202 - Candidate is: '/j_spring_security_check'; pattern is /**; matched=true
    17:50:15,937 DEBUG FilterChainProxy:375 - /j_spring_security_check at position 1 of 10 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
    17:50:15,937 DEBUG HttpSessionSecurityContextRepository:142 - HttpSession returned null object for SPRING_SECURITY_CONTEXT
    17:50:15,937 DEBUG HttpSessionSecurityContextRepository:88 - No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@1646cc0. A new one will be created.
    17:50:15,937 DEBUG FilterChainProxy:375 - /j_spring_security_check at position 2 of 10 in additional filter chain; firing Filter: 'LogoutFilter'
    17:50:15,937 DEBUG FilterChainProxy:375 - /j_spring_security_check at position 3 of 10 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
    17:50:15,937 DEBUG UsernamePasswordAuthenticationFilter:193 - Request is to process authentication
    17:50:15,984 DEBUG XmlWebApplicationContext:301 - Publishing event in Root WebApplicationContext: org.springframework.security.authentication.event.AuthenticationFailureProviderNotFoundEvent[source=org.springframework.security.authentication.UsernamePasswordAuthenticationToken@12e80: Principal: aaa; Credentials: [PROTECTED]; Authenticated: false; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@12afc: RemoteIpAddress: 127.0.0.1; SessionId: BB86612B948D92F37FEFAEDAD222551E; Not granted any authorities]
    17:50:15,984 DEBUG UsernamePasswordAuthenticationFilter:318 - Authentication request failed: org.springframework.security.authentication.ProviderNotFoundException: No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken
    17:50:15,984 DEBUG UsernamePasswordAuthenticationFilter:319 - Updated SecurityContextHolder to contain null Authentication
    17:50:15,984 DEBUG UsernamePasswordAuthenticationFilter:320 - Delegating to authentication failure handlerorg.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler@13d2bab
    17:50:15,984 DEBUG SimpleUrlAuthenticationFailureHandler:67 - Redirecting to /login.action
    17:50:15,984 DEBUG DefaultRedirectStrategy:36 - Redirecting to '/login.action'
    Full log is here: http://rapidshare.com/files/443075197/portal.log

    What happens when you enter credentials in your login form? Do you get logged in? Do you get an error? What page do you end up at?
    In normal working app I should enter dashboard.action (default-target-url in config), and with config <security:user name="jimi" password="jimi" authorities="ROLE_ADMIN" /> I hit it.
    Now nothing happened: I allways stay on login page.
    Last edited by kostepanych; Jan 17th, 2011 at 10:31 AM.

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

    Default

    Quote Originally Posted by kostepanych View Post
    I receive ProviderNotFoundException: No AuthenticationProvider found for org.springframework.security.authentication.Userna mePasswordAuthenticationToken:
    This sounds like the MyAuthenticationProvider.supports method is not returning true. Try adding a debug point to it and see if it returns true.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #23
    Join Date
    Jan 2011
    Posts
    27

    Default

    Thanks to all. The debugging resolved the problem. It was my stupid inattention mistake.

    Also I have small question. To mark authentification error I use authentication-failure-url="/login.action?login_error=1", and check login_error param in JSP.
    But maybe there are some parameters that are set automatically in case of bad login?

  4. #24
    Join Date
    Jan 2009
    Location
    Pune
    Posts
    58

    Default

    No,

    When authentication fails, it returns nothing. That time the url in "authentication-failure-url" will be display in url section.

  5. #25
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    Quote Originally Posted by kostepanych View Post
    But maybe there are some parameters that are set automatically in case of bad login?
    You could check the session to see if the SPRING_SECURITY_LAST_EXCEPTION attribute is set. Just make sure you delete it if it is there, so that the user doesn't continue to see the error.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

Posting Permissions

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