code: protected PrincipalUser validateAndGetOwner(HttpServletRequest req, String ownerName) {
          PrincipalUser remoteUser = getRemoteUser(req);
  
          
          if (ownerName == null || ownerName.isEmpty() || ownerName.equalsIgnoreCase(remoteUser.getUserName())) {
          	//If ownerName is not present or if it is present and equal to remote username, then return remoteUser.
              return remoteUser;
          } else if (remoteUser.isPrivileged()) {
              PrincipalUser owner;
  
              owner = userService.findUserByUsername(ownerName);
              if (owner == null) {
                  throw new WebApplicationException(ownerName + ": User does not exist.", Status.NOT_FOUND);
              } else {
                  return owner;
              }
          }
          throw new WebApplicationException(Status.FORBIDDEN.getReasonPhrase(), Status.FORBIDDEN);
      }
docs: Validates the owner name and returns the owner object.
  
  @param   req        The HTTP request.
  @param   ownerName  Name of the owner. It is optional.
  
  @return  The owner object
  
  @throws  WebApplicationException  Throws exception if owner name does not exist.