private void checkGroupList(List<PrincipalId> groupList,PrincipalId subject) throws InvalidTokenException, SystemException {
  PrincipalAttributeDefinition groupAttributeDefinition=getSupportedAttributeDefinition(GROUP);
  if (groupAttributeDefinition == null) {
    throw new InvalidTokenException(GROUP + " is not supported attribute in token attributes.");
  }
  final PrincipalAttribute groupAttribute;
  try {
    groupAttribute=getAttribute(subject,groupAttributeDefinition);
  }
 catch (  InvalidPrincipalException e) {
    throw new InvalidTokenException(String.format("Principal %s not found, race condition suspected since the principal has just been validated.",subject),e);
  }
  List<PrincipalId> currentGroupList=toGroupList(groupAttribute.getValues());
  List<PrincipalId> tokenGroupList=groupList;
  if (tokenGroupList.size() != currentGroupList.size() || !tokenGroupList.containsAll(currentGroupList)) {
    throw new InvalidTokenException("Current group membership of " + "the principal is different from the one stated in the token");
  }
}

private void checkGroupList ( List < PrincipalId > groupList , PrincipalId subject ) throws InvalidTokenException , SystemException { PrincipalAttributeDefinition groupAttributeDefinition = getSupportedAttributeDefinition ( GROUP ) ; if ( groupAttributeDefinition == null ) { throw new InvalidTokenException ( GROUP + " is not supported attribute in token attributes." ) ; } final PrincipalAttribute groupAttribute ; try { groupAttribute = getAttribute ( subject , groupAttributeDefinition ) ; } catch ( InvalidPrincipalException e ) { throw new InvalidTokenException ( String . format ( "Principal %s not found, race condition suspected since the principal has just been validated." , subject ) , e ) ; } List < PrincipalId > currentGroupList = toGroupList ( groupAttribute . getValues ( ) ) ; List < PrincipalId > tokenGroupList = groupList ; if ( tokenGroupList . size ( ) != currentGroupList . size ( ) || ! tokenGroupList . containsAll ( currentGroupList ) ) { throw new InvalidTokenException ( "Current group membership of " + "the principal is different from the one stated in the token" ) ; } }
checks if the group list from the token is equal to the current group list for the given principal
