Class SecurityUtils

java.lang.Object
org.eclipse.jetty.util.security.SecurityUtils

public class SecurityUtils extends Object

Collections of utility methods to deal with the scheduled removal of the security classes defined by JEP 411.

  • Method Details

    • getSecurityManager

      public static Object getSecurityManager()
      Get the current security manager, if available.
      Returns:
      the current security manager, if available
    • checkPermission

      public static void checkPermission(Permission permission) throws SecurityException

      Checks the given permission, if the security manager is set.

      Parameters:
      permission - the permission to check
      Throws:
      SecurityException - if the permission check fails
    • doPrivileged

      public static <T> T doPrivileged(PrivilegedAction<T> action)

      Runs the given action with the calling context restricted to just the calling frame, not all the frames in the stack.

      Type Parameters:
      T - the type of the result
      Parameters:
      action - the action to run
      Returns:
      the result of running the action
    • doAs

      public static <T> T doAs(Subject subject, Callable<T> action)

      Runs the given action as the given subject.

      Type Parameters:
      T - the type of the result
      Parameters:
      subject - the subject this action runs as
      action - the action to run
      Returns:
      the result of the action