Class SecondaryNodeSecurityManager


  • public final class SecondaryNodeSecurityManager
    extends Object
    Security manger which controls access to data directory on the secondary node.
    • Method Detail

      • reset

        public static void reset()
      • addWritablePath

        public static void addWritablePath​(@NotNull
                                           File filePath)
        Registers some path on disk as a path where write operation should be allowed
      • addReadOnlyPath

        public static void addReadOnlyPath​(@NotNull
                                           File filePath)
        Registers some path on disk as a path where write operation should NOT be allowed
      • removePath

        public static void removePath​(@NotNull
                                      File filePath)
      • executeSafe

        public static <E extends Throwable> void executeSafe​(@NotNull
                                                             ActionThrow<E> actionThrow,
                                                             @NotNull
                                                             Set<RestrictedOperation> operations)
                                                      throws E extends Throwable
        Code that wants to run safe but restricted operation on read-only node should be wrapped in this method.
        Throws:
        E extends Throwable
      • executeSafe

        public static <R,​E extends Throwable> R executeSafe​(@NotNull
                                                                  FuncThrow<R,​E> funcThrow,
                                                                  @NotNull
                                                                  Set<RestrictedOperation> operations)
                                                           throws E extends Throwable
        Code that wants to run safe but restricted operation on read-only node should be wrapped in this method.
        Throws:
        E extends Throwable
      • runSafeDiskWriteOperation

        public static <E extends Throwable> void runSafeDiskWriteOperation​(@NotNull
                                                                           ActionThrow<E> actionThrow)
                                                                    throws E extends Throwable
        Code that wants to run file operation should be wrapped to this method.
        Throws:
        E extends Throwable
      • runSafeDiskWriteOperation

        public static <R,​E extends Throwable> R runSafeDiskWriteOperation​(@NotNull
                                                                                FuncThrow<R,​E> funcThrow)
                                                                         throws E extends Throwable
        Code that wants to run file operation should be wrapped to this method.
        Throws:
        E extends Throwable
      • runSafeNetworkOperation

        public static <E extends Throwable> void runSafeNetworkOperation​(@NotNull
                                                                         ActionThrow<E> actionThrow)
                                                                  throws E extends Throwable
        Code that wants to run read-only safe network operation should be wrapped to this method. All other attempts to run network operations will fail.
        Throws:
        E extends Throwable
      • runSafeNetworkOperation

        public static <R,​E extends Throwable> R runSafeNetworkOperation​(@NotNull
                                                                              FuncThrow<R,​E> funcThrow)
                                                                       throws E extends Throwable
        Code that wants to run read-only safe network operation should be wrapped to this method. All other attempts to run network operations will fail.
        Throws:
        E extends Throwable
      • executeSafeCommandLine

        public static <E extends Throwable> void executeSafeCommandLine​(@NotNull
                                                                        ActionThrow<E> actionThrow)
                                                                 throws E extends Throwable
        Code that wants to run read-only safe external command-line should be wrapped to this method. All other attempts to run the command line will fail.
        Throws:
        E extends Throwable
      • executeSafeCommandLine

        public static <R,​E extends Throwable> R executeSafeCommandLine​(@NotNull
                                                                             FuncThrow<R,​E> funcThrow)
                                                                      throws E extends Throwable
        Code that wants to run read-only safe external command-line should be wrapped to this method. All other attempts to run the command line will fail.
        Throws:
        E extends Throwable
      • addAllowedClassNamePrefix

        public static void addAllowedClassNamePrefix​(@NotNull
                                                     RestrictedOperation operation,
                                                     @NotNull
                                                     String classNamePrefix)
        Allows granting access to classes with a specified class name prefix. Once a prefix is registered, next check by a security manager will analyze stacktrace and if it finds a class with the provided prefix, then the access will be granted.
        Parameters:
        classNamePrefix -
        Since:
        2022.04.2