public void changePassword(String oldPassword, String newPassword) {
User user = getCurrentUser();
Authentication oldAuth = new UsernamePasswordAuthenticationToken(
user.getUsername(), oldPassword);
authMgr.authenticate(oldAuth);
createPassWord(user, newPassword);
log.debug("password changed, saving");
save(user);
log.debug("remove from cache");
userCache.removeUserFromCache(user.getUsername());
log.debug("change security context");
Authentication newAuthentication = new UsernamePasswordAuthenticationToken(
user.getUsername(), newPassword);
authMgr.authenticate(newAuthentication);
SecurityContextHolder.getContext().setAuthentication(
newAuthentication);