/**
* 获取用户Detail信息的回调函数.
*/
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
User user = accountManager.findUserByLoginName(username);
if (user == null) {
throw new UsernameNotFoundException("用户" + username + " 不存在");
}
Set<GrantedAuthority> grantedAuths = obtainGrantedAuthorities(user);
//showcase的User类中无以下属性,暂时全部设为true.
boolean enabled = true;
boolean accountNonExpired = true;
boolean credentialsNonExpired = true;
boolean accountNonLocked = true;
OperatorDetails userDetails = new OperatorDetails(user.getLoginName(), user.getShaPassword(), enabled,
accountNonExpired, credentialsNonExpired, accountNonLocked, grantedAuths);
//加入登录时间信息和用户角色
userDetails.setLoginTime(new Date());
userDetails.setRoleList(user.getRoleList());
return userDetails;
}