title: BCryptPasswordEncoder not working after upgrade to spring secrity 5
body: <p>after upgrading
  - spring: 4.3.23.RELEASE -> 5.1.6.RELEASE
  - spring-security: 4.2.12.RELEASE -> 5.1.5.RELEASE
  My implementation of BCryptPasswordEncoder does not work anymore.</p>
  
  <p>WARN [o.bcrypt.BCryptPasswordEncoder:  90] Encoded password does not look like BCrypt </p>
  
  <p>i added some logging to get rawPassword, encodedPassword</p>
  
  <p>spring4:
  test1234,$2a$10$vcwRRfjPKrnXoGhDlGzJUe8ntNJEcWlHqc1l8QiDmwroB3WkJ96ma</p>
  
  <p>spring5/5.1:
  1a7emcO6sXmV,1a7emcO6sXmV</p>
  
  <p>So the problem is that the method is called with some already encoded or hashed version of the password? I cannot find this behavior anywhere documented. How to turn it off? Of course the password matches in some magic way but i did not get the case-insensitive behavior.</p>
  
  <pre class="lang-java prettyprint-override"><code>public class IgnoreCaseBcryptPasswordEncoder extends BCryptPasswordEncoder {
  
      Logger logger = LogManager.getLogger(getClass());
  
      @Override
      public String encode(CharSequence rawPassword) {
          return super.encode(rawPassword.toString().trim().toLowerCase());
      }
  
      @Override
      public boolean matches(CharSequence rawPassword, String encodedPassword) {
          logger.trace(rawPassword + "," + encodedPassword);
          logger.trace(Arrays.toString(new Throwable().getStackTrace()));
          return super.matches(rawPassword.toString().toLowerCase(), encodedPassword);
      }
  }
  </code></pre>
  
  <p>and XML Config:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;bean id="passwordEncoder" class="de.k2interactive.qeep.security.oauth2.IgnoreCaseBcryptPasswordEncoder"/&gt;
  
      &lt;sec:authentication-manager id="userAuthentificationManager"&gt;
          &lt;sec:authentication-provider user-service-ref="customUserDetailsService"&gt;
              &lt;sec:password-encoder ref="passwordEncoder" /&gt;
          &lt;/sec:authentication-provider&gt;
      &lt;/sec:authentication-manager&gt;
  
      &lt;oauth:authorization-server token-endpoint-url="/oauth/token" client-details-service-ref="clientDetails" token-services-ref="tokenServices"&gt;
          &lt;oauth:authorization-code /&gt;
          &lt;oauth:implicit /&gt;
          &lt;oauth:refresh-token /&gt;
          &lt;oauth:client-credentials /&gt;
          &lt;oauth:password authentication-manager-ref="userAuthentificationManager"/&gt;
          &lt;oauth:custom-grant token-granter-ref="qeepFacebookLogin"/&gt;
          &lt;oauth:custom-grant token-granter-ref="qeepGoogleLogin"/&gt;
          &lt;oauth:custom-grant token-granter-ref="qeepAccountKitLogin"/&gt;
      &lt;/oauth:authorization-server&gt;
  
      &lt;oauth:client-details-service id="clientDetails"&gt;
          &lt;oauth:client client-id="trusted-ios-client" authorized-grant-types="password,facebook_access_token,accountkit,authorization_code,refresh_token,implicit"
                        secret="XXXcutXXX" authorities="ROLE_CLIENT, ROLE_TRUSTED_CLIENT" /&gt; 
          &lt;oauth:client client-id="trusted-android-client" authorized-grant-types="password,facebook_access_token,google_access_token,accountkit,authorization_code,refresh_token,implicit"
                        secret="XXXcutXXX" authorities="ROLE_CLIENT, ROLE_TRUSTED_CLIENT" /&gt;                      
      &lt;/oauth:client-details-service&gt;
  
  </code></pre>
  
  <p>Stacktrace (Spring5):</p>
  
  <pre class="lang-java prettyprint-override"><code>[de.k2interactive.qeep.security.oauth2.IgnoreCaseBcryptPasswordEncoder.matches(IgnoreCaseBcryptPasswordEncoder.java:31), 
  org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:90),
  org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:166),
  org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:175),
  org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:200),
  org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:180),
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107),
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334),
  org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74),
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107),
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334),
  org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56),
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107),
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334),
  org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105),
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334),
  org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:157),
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334),
  org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215),
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178),
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357),
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270),
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193),
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166),
  org.springframework.web.filter.AbstractRequestLoggingFilter.doFilterInternal(AbstractRequestLoggingFilter.java:262),
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107),
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193),
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166),
  org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109),
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193),
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166),
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200),
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96),
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490),
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139),
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92),
  org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678),
  org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679),
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74),
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343),
  org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408),
  org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66),
  org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:836),
  org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2120),
  org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49),
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149),
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624),
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61),
  java.lang.Thread.run(Thread.java:748)]
  </code></pre>