Results 1 to 2 of 2

Thread: 2-stage preauthentication

  1. #1
    Join Date
    Sep 2010
    Posts
    4

    Default 2-stage preauthentication

    Our scheme uses a 2-stage authentication system. A users x509 certificate is validated using the x509preauthprocessingfilter, and we have a custom preAuthenticationAuthenticationProvider that provides some final checks on the certificate and throws exceptions if it's bad. The next stage loads our userdetails from a database based on an association from x509 to the user. However, if the user has a valid certificate but is not registered, I want to send him to a registration page. What's the simplest way to do that?

    I've considered an exceptionTranslationFilter, however it looks like it handles every exception and I'd only want it to catch UserNotFoundException. I've also considered returning a dummy user object and redirecting based on his roles. However, this feels dirty and there must be something simple I'm missing. Any thoughts?

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

    Default

    The ExceptionTranslationFilter has a way to specify which exceptions you want to handle, but it would not catch an Exception thrown by a PreAuthFilter since it is earlier in the FilterChain. My recommendation to you would be to use an AuthenticationFailureHandler similar to how the AbstractAuthenticationProcessingFilter works.
    Rob Winch
    Twitter @rob_winch
    Spring Security Lead
    Spring by Pivotal

Tags for this Thread

Posting Permissions

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