Class RestrictedFileUtils

java.lang.Object
net.sourceforge.jnlp.util.RestrictedFileUtils

public final class RestrictedFileUtils extends Object
This class contains a method to create restricted files.
  • Field Details

    • LOG

      private static final Logger LOG
    • WIN_PRINCIPAL_SIDS

      private static final List<String> WIN_PRINCIPAL_SIDS
  • Constructor Details

    • RestrictedFileUtils

      public RestrictedFileUtils()
  • Method Details

    • createRestrictedDirectory

      public static void createRestrictedDirectory(File directory) throws IOException
      Creates a new directory with minimum permissions. The directory is not readable or writable by anyone other than the owner. The parent directories are not created; they must exist before this is called.
      Parameters:
      directory - directory to be created
      Throws:
      IOException - if IO fails
    • createRestrictedFile

      public static void createRestrictedFile(File file) throws IOException
      Creates a new file with minimum permissions. The file is not readable or writable by anyone other than the owner. If writeableByOwner is false, even the owner can not write to it.
      Parameters:
      file - path to file
      Throws:
      IOException - if IO fails
    • createRestrictedFile

      private static void createRestrictedFile(File file, boolean isDir) throws IOException
      Creates a new file or directory with minimum permissions. The file is not readable or writable by anyone other than the owner. If writeableByOwner is false, even the owner can not write to it. If isDir is true, then the directory can be executed by the owner
      Throws:
      IOException
    • createFileOrDir

      private static void createFileOrDir(File file, boolean isDir) throws IOException
      Throws:
      IOException
    • principalInWinSIDS

      public static boolean principalInWinSIDS(Principal principal)
    • getSIDForPrincipal

      public static String getSIDForPrincipal(Principal principal)
    • findMethod

      private static Method findMethod(Class<?> clazz, String methodName)