code: private static String getCurrentUserName() {
          Authentication a = SecurityContextHolder.getContext().getAuthentication();
          if (a == null) return null;
          org.springframework.security.core.userdetails.User u =
                  (org.springframework.security.core.userdetails.User)
                          a.getPrincipal();
          if (u == null) return null;
          return u.getUsername();
      }
docs: or null if nobody's logged in