title: AuthenticationEntryPoint only sometimes called
body: <p>I have a simple <code>AuthenticationEntryPoint</code> which should set the WWW-Authenticate header for unauthorized requests.</p>
  
  <pre><code>@Component
  public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {
  
      @Override
      public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
              throws IOException, ServletException {
          response.setHeader("WWW-Authenticate", "FormBased");
          response.sendError(401, authException.getMessage());
      }
  }
  </code></pre>
  
  <p>I use it in one of the configure methods of <code>AuthorizationServerConfigurer</code></p>
  
  <pre><code>@Override
  public void configure(AuthorizationServerSecurityConfigurer authorizationServerSecurityConfigurer) throws Exception {
      authorizationServerSecurityConfigurer.authenticationEntryPoint(authenticationEntryPoint);
  }
  </code></pre>
  
  <p>This commence method is not always called, though. It gets called when there is no Authorize header in the request or when the Authorize header value doesn't start with 'Basic'. However, if the Authorize header starts with 'Basic', the commence method is not called (and the value of the response is <code>Basic realm="oauth2/client"</code>). How can I ensure that this method gets called?</p>