DefaultLoginPlugin implements OnLoginRunnable { @SuppressWarnings("deprecation") @Override public boolean validateUser(String userId, String password, String encPass, Object encoder, Object salt) { if (StringUtils.isEmpty(password) || !((ShaPasswordEncoder) encoder).matches(String.valueOf(salt), password, encPass)) { LOG.debug("Authentication failed: password does not match stored value"); throw new BadCredentialsException(messages.getMessage( "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")); } return true; }  @Override User loadUser(String userId); @SuppressWarnings("deprecation") @Override boolean validateUser(String userId, String password, String encPass, Object encoder, Object salt); @Deprecated @Override void saveUser(User user);  }
@Test public void testValidateUser() { DefaultLoginPlugin plugin = new DefaultLoginPlugin(null); String salt = TEST_USER_ID; try { plugin.validateUser(TEST_USER_ID, TEST_USER_PASSWORD, TEST_USER_PASSWORD, passwordEncoder, salt); } catch (BadCredentialsException e) { assertTrue(true); } plugin.validateUser(TEST_USER_ID, TEST_USER_PASSWORD, passwordEncoder.encode(salt, TEST_USER_PASSWORD), passwordEncoder, salt); assertTrue(true); }