I have this class:
public class CustomPasswordEncoder implements PasswordEncoder {
@Autowired
private JdbcTemplate jdbcTemplate;
@Inject
private PasswordEncoder passwordEncoder;
public String encode(CharSequence rawPassword) {
String hashedPass;
String userLogin;
String encryptedPassword;
sql = "select PasswordHash('?','?') from dual";
hashedPass = (String)getJdbcTemplate().queryForObject(
sql, new Object[] { userLogin,rawPassword }, String.class);
encryptedPassword = passwordEncoder.encode(hashedPass);
return encryptedPassword;
}
}
What I need to do is get the USERNAME from the form and have it in the userLogin variable. I am finding it quite difficult to get the username from the form into this customized PasswordEncoder
来源:https://stackoverflow.com/questions/38136228/spring-security-how-do-i-grab-the-attempted-username-trying-to-log-in