title: Spring security returns 401, On sending date as input to the rest controller
body: <pre><code>@Configuration
  @EnableWebSecurity
  @EnableGlobalMethodSecurity(prePostEnabled = true)
  public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
  
      @Autowired
      private UserDetailsInfoService userDetailsService;
  
      @Autowired
      private CustomLoginAuthenticationProvider authenticationProvider;
  
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          auth.authenticationProvider(authenticationProvider);
          auth.userDetailsService(userDetailsService);
  
      }
  
      @Override
      public void configure(WebSecurity web) throws Exception {
  
          web.ignoring()
          .antMatchers("/api/user/authenticate/**")
          .antMatchers("/api/user/**")
          .antMatchers("/api/master/**")
      }
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.csrf().disable();
      }
  
     @Override
      @Bean
      public AuthenticationManager authenticationManagerBean() throws Exception {
         return super.authenticationManagerBean();
      }
  
     /* @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
      private static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration {
          @Override
          protected MethodSecurityExpressionHandler createExpressionHandler() {
              return new OAuth2MethodSecurityExpressionHandler();
          }
  
      }*/
  
  }
  </code></pre>
  
  <p>This is my spring security configuration in the application.
  It works fine most of the scenarios, but not able to track one issue.</p>
  
  <p>Whenever I call a web service with a date format spring security returns 401 error.</p>
  
  <pre><code>http://localhost:9190/nazouki/api/master/create
  </code></pre>
  
  <p>with input </p>
  
  <pre><code>{"orgId":"11","birthDate":"2020-04-20T20:00:00.000Z"}
  </code></pre>
  
  <p>without date it works fine.</p>
  
  <p>Controller code</p>
  
  <pre><code>@RequestMapping(value = "master/create", method = RequestMethod.POST)
      public @ResponseBody ResultDecorator createMaster(@RequestBody  TuMasterDto tuMasterDto){       handler.resolveResult(masterService.createMaster(tuMasterDto), OperationEnum.SAVE);
      }
  </code></pre>
  
  <p>Exception has been thrown from the CustomAuthenticationEntryPoint in the spring security.</p>
  
  <pre><code>@Component
  public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {
  
      private final Logger log = LoggerFactory.getLogger(CustomAuthenticationEntryPoint.class);
  
      public void commence(HttpServletRequest request,
                           HttpServletResponse response,
                           AuthenticationException ae) throws IOException, ServletException {
  
          log.info("Pre-authenticated entry point called. Rejecting access");
          response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Access Denied");
  
      }
  }
  </code></pre>