code: @Override
      public String getSSODomainName(HttpServletRequest req, List<String> ssoDomainList, boolean useDomainFromURL) {
          try {
              final String host = getHostNameFromRequestURL(req);
              String ipAddr = AccessController.doPrivileged(new PrivilegedAction<String>() {
  
                  @Override
                  public String run() {
                      return getHostIPAddr(host);
                  }
              });
              if (host.equals(ipAddr) || host.indexOf(".") == -1) {
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      Tr.debug(tc, "URL host is an IP or locahost, no SSO domain will be set.");
                  return null;
              }
              String domain = host.substring(host.indexOf("."));
              if (ssoDomainList != null && !ssoDomainList.isEmpty()) {
                  for (Iterator<String> itr = ssoDomainList.iterator(); itr.hasNext();) {
                      String dm = itr.next();
                      if (domain.endsWith(dm))
                          return dm;
                  }
              }
              if (useDomainFromURL) {
                  return domain;
              }
          } catch (MalformedURLException e) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "Unexpected exception getting request SSO domain", new Object[] { e });
          }
          return null;
      }
docs: Returns the SSO domain based. Expected return values are derived from the domain name
  of the host name in the request which may be matched with the WebAppConfig domain name
  list. If there is no match with the ssoDomainList and useURLDomain=true, returns the
  hostname domain. Otherwise it returns null for the following conditions:
  1) ssoDomainList is null
  2) The hostname is not fully qualify or localhost
  3) useURLDomain is false
  3) Request URL is an IP address
  
  @param req
  @param ssoDomainList
  @param useDomainFromURL
  @return