docs: @SuppressWarnings("unchecked")
      protected Object getPreAuthenticatedPrincipal(PortletRequest request) {
  
          // first try getRemoteUser()
          String remoteUser = request.getRemoteUser();
          if (remoteUser != null) {
              return remoteUser;
          }
  
          // next try getUserPrincipal()
          Principal userPrincipal = request.getUserPrincipal();
          if (userPrincipal != null) {
              String userPrincipalName = userPrincipal.getName();
              if (userPrincipalName != null) {
                  return userPrincipalName;
              }
          }
  
          // last try entries in USER_INFO if any attributes were defined
          if (this.userNameAttributes != null) {
              Map<String, String> userInfo = null;
              try {
                  userInfo = (Map<String, String>)request.getAttribute(PortletRequest.USER_INFO);
              } catch (Exception e) {
                  logger.warn("unable to retrieve USER_INFO map from portlet request", e);
              }
              if (userInfo != null) {
                  Iterator<String> i = this.userNameAttributes.iterator();
                  while(i.hasNext()) {
                      Object principal = (String)userInfo.get(i.next());
                      if (principal != null) {
                          return principal;
                      }
                  }
              }
          }
  
          // none found so return null
          return null;
      }