Thank you.
/M
Am 27/05/2010 20:28, schrieb Todd Orr:
I exported all the data access code into an independent DAO that is still
managed by Spring. Then I added a constructor to my UserDetailsService that
took the dao plus the salt and encoder:
private final static Logger LOG =
LoggerFactory.getLogger(UserDetailsServiceImpl.class);
private final Dao dao;
private final PasswordEncoder passwordEncoder;
private final SaltSource saltSource;
/**
* Default constructor.
*/
public UserDetailsServiceImpl(Dao dao, PasswordEncoder encoder, SaltSource
salt) {
dao = dao;
passwordEncoder = encoder;
saltSource = salt;
}
/**
* Try to find the given user in the local database.
*/
public UserDetails loadUserByUsername(String username) throws
UsernameNotFoundException {
LOG.debug("Attempting to locate user with username \"{}\"", username);
User user = dao.findUserByUsername(username);
if (user != null) {
// encode the password
user.setPassword(passwordEncoder.encodePassword(user.getPassword(),
saltSource.getSalt(user)));
}
LOG.debug("Located user: {}", user);
return new User(user);
}
Then updated my module to provide the dependencies:
public static UserDetailsService buildUserDetailsService(Dao dao, @Inject
PasswordEncoder encoder,
@Inject SaltSource salt) {
return new UserDetailsServiceImpl(dao, encoder, salt);
}
On Thu, May 27, 2010 at 1:53 PM, Michael Gerzabek
<michael.gerza...@gmx.net>wrote:
Just for the records. What did you change now?
Am 27/05/2010 19:48, schrieb Todd Orr:
I changed the code so that these are injected and now it works. I cannot
describe how angry this makes me. Days wasted.
Thanks for you help though!!!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org