title: How to update the SecurityContextHolder username for the update for current user
body: <p>In my application when the current logged in user's usernam is changed i want to update the UserDetails principal for the current user. How can I do that? I'm getting the current username by following method :</p>
  
  <pre><code> public UserDetails getSystemUser(){
      try {
          UserDetails principal  = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
          return  principal;
      }catch (ClassCastException e){
          return null;
      }
  }
  </code></pre>