docs: @SuppressWarnings("unchecked")
      protected void handleGroupPrincipalCallback(GroupPrincipalCallback callback) throws CustomRegistryException, EntryNotFoundException, RemoteException {
          Subject clientSubject = callback.getSubject();
          Hashtable<String, Object> credData = null;
          if (clientSubject != null) {
              String[] groupsFromCallback = callback.getGroups();
              if (groupsFromCallback != null && groupsFromCallback.length > 0) {
                  if (tc.isDebugEnabled()) {
                      Tr.debug(tc, "Group names in Callback: ", Arrays.asList(groupsFromCallback));
                  }
                  credData = getSubjectCustomData(clientSubject);
                  List<String> groupsFromSubject = (List<String>) credData.get(AttributeNameConstants.WSCREDENTIAL_GROUPS);
                  if (groupsFromSubject == null) {
                      groupsFromSubject = new ArrayList<String>();
                      credData.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, groupsFromSubject);
                  }
  
                  for (int i = 0; i < groupsFromCallback.length; i++) {
                      String groupFromCallback = groupsFromCallback[i];
                      if (groupFromCallback == null || groupFromCallback.isEmpty()) {
                          if (tc.isDebugEnabled()) {
                              Tr.debug(tc, "Group is null or an empty string, it has been ignored.");
                          }
                          continue;
                      }
  
                      String group = mapGroup(groupFromCallback);
  
                      if (!groupsFromSubject.contains(group)) {
                          groupsFromSubject.add(group);
                          if (tc.isDebugEnabled()) {
                              Tr.debug(tc, "Added groupId: " + group);
                          }
                      } else {
                          if (tc.isDebugEnabled()) {
                              Tr.debug(tc, group + " already exists in custom credential data, avoid duplicates.");
                          }
                      }
                  }
              } else {
                  if (tc.isDebugEnabled()) {
                      Tr.debug(tc, "Callback has no groups.");
                  }
              }
          }
          if (tc.isDebugEnabled()) {
              Tr.debug(tc, "handleGroupPrincipalCallback", credData);
          }
      }