title: Spring Security: How to validate password length
body: <p>I have a Maven, Spring Boot, Spring MVC, AngularJS stack project. For the login page I use Spring Security to handle the username/password form submit validation (from angularJS client). It works fine but I also need to validate that the incoming password field is not longer than a specific length (before even its checked for validation) (I read that this exposes a certain security risk when using ByCrypt, since users can send extremely long passwords, which takes too much time for hashing)</p>
  
  <p>Anyway is there a way to accomplish this with Spring Security? Probably I could do it in my CustomUserDetailService or SpringSecurityConfiguration class but couldn't figure out how.</p>