title: Can't use subclass of AuthenticationException
body: <p>I am trying to make an exception subclass of <code>AuthenticationException</code> as follows:</p>
  
  <pre><code>public class RegistrationNotCompleteException extends AuthenticationException {
      public RegistrationNotCompleteException(String msg) {
          super(msg);
      }
  }
  </code></pre>
  
  <p>and in the <code>loadUserByUsername</code> of my <code>UserDetailsService</code> class I make the following check:</p>
  
  <pre><code>if (!user.getHasRegistered()) {
      System.out.println("######## User: " + username
          + " has not completed the registration");
      throw new RegistrationNotCompleteException(
          "User has not completed registration");
  }
  </code></pre>
  
  <p>so the user is forwarded to the <code>AuthenticationFailureHandler</code> class as expected.</p>
  
  <p>But when trying to get the exception class in the <code>onAuthenticationFailure</code> method as follows:</p>
  
  <pre><code>public void onAuthenticationFailure(HttpServletRequest request,
      HttpServletResponse response, AuthenticationException exception)
      throws IOException, ServletException {
  
      UsernamePasswordAuthenticationToken token =
          (UsernamePasswordAuthenticationToken) exception.getAuthentication();
      String username = token.getName();
      String credentials = token.getCredentials().toString();
      System.out.println("Exception class: " + exception.getClass());
  </code></pre>
  
  <p>it prints that the exception class is <code>AuthenticationException</code> not <code>RegistrationNotCompleteException</code>.</p>
  
  <p>And I want to verify that the exception class is <code>RegistrationNotCompleteException</code>.</p>
  
  <p>Please advise how to do that.</p>