title: Spring Boot Security: Encoded password does not look like BCrypt
body: <p>I recently followed an authentication and authorization tutorial in spring boot security and I think I got lost when it comes to the sql. Though it is not showing any errors, even when I put the correct username and password, it still shows bad credentials. Here is my code:</p>
  
  <p>UserDetailsServiceImpl.java</p>
  
  <pre><code>    @Override
      public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
          WebUser appUser = this.appUserDAO.findUserAccount(userName);
  
          if (appUser == null) {
              System.out.println("User not found! " + userName);
              throw new UsernameNotFoundException("User " + userName + " was not found in the database");
          }
  
          System.out.println("Found User: " + appUser);
  
          // [ROLE_USER, ROLE_ADMIN,..]
          List&lt;String&gt; roleNames = this.appRoleDAO.getRoleNames(appUser.getId());
  
          List&lt;GrantedAuthority&gt; grantList = new ArrayList&lt;GrantedAuthority&gt;();
          if (roleNames != null) {
              for (String role : roleNames) {
                  // ROLE_USER, ROLE_ADMIN,..
                  GrantedAuthority authority = new SimpleGrantedAuthority(role);
                  grantList.add(authority);
              }
          }
  
          UserDetails userDetails = (UserDetails) new User(appUser.getUsername(), //
                  appUser.getPass(), grantList);
  
          return userDetails;
      }
  </code></pre>
  
  <p>WebUserMapper.java</p>
  
  <pre><code>public static final String BASE_SQL //
  = "Select u.Id, u.Username, u.Pass From User u ";
  
  @Override
  public WebUser mapRow(ResultSet rs, int rowNum) throws SQLException {
  
      Long userId = rs.getLong("Id");
      String userName = rs.getString("Username");
      String encrytedPassword = rs.getString("Pass");
  
      return new WebUser(userId, userName, encrytedPassword);
  }
  </code></pre>
  
  <p>WebSecurityConfig.java</p>
  
  <pre><code>    @Bean
      public BCryptPasswordEncoder passwordEncoder() {
          BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
          return bCryptPasswordEncoder;
      }
  
      @Autowired
      public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 
  
          // Setting Service to find User in the database.
          // And Setting PassswordEncoder
          auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());     
  
      }
  </code></pre>
  
  <p>This is my database:</p>
  
  <p><a href="https://i.stack.imgur.com/KnCkH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KnCkH.png" alt="enter image description here"></a></p>
  
  <p>It returns this error:</p>
  
  <pre><code>Found User: test/$2y$12$MemyV61IuKV7SAntLOEVqeLPPvl2snXjQwlk3RSFDmn5eWrRcHwxm
  2018-10-21 20:32:57.110  WARN 1300 --- [nio-8080-exec-3] o.s.s.c.bcrypt.BCryptPasswordEncoder     : Encoded password does not look like BCrypt
  </code></pre>
  
  <p>The password is 123. I don't know why it's not working even though I typed "123" in the password.I hope you could help me. Thank you so much</p>