*
* @see org.springframework.security.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
*/
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
if (StringUtils.isBlank(username)) {
throw new UsernameNotFoundException("Cannot retrieve user without a valid username");
}
String encryptedPassword = null;
try {
encryptedPassword = WikiBase.getDataHandler().lookupWikiUserEncryptedPassword(username);
} catch (org.jamwiki.DataAccessException e) {
throw new DataAccessResourceFailureException("Unable to retrieve authorities for user: " + username, e);
}
if (encryptedPassword == null) {
throw new UsernameNotFoundException("Failure retrieving user information for " + username);
}
Collection<GrantedAuthority> authorities = this.retrieveUserAuthorities(username);
return new WikiUserDetails(username, encryptedPassword, true, true, true, true, authorities);
}