Class SecurityUtilities


  • public class SecurityUtilities
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.security.ProtectionDomain getProtectionDomain​(java.lang.Class<?> clazz)  
      static java.security.ProtectionDomain getScriptProtectionDomain()
      Look up the top-most element in the current stack representing a script and return its protection domain.
      static java.lang.String getSystemProperty​(java.lang.String name)
      Retrieves a system property within a privileged block.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SecurityUtilities

        public SecurityUtilities()
    • Method Detail

      • getSystemProperty

        public static java.lang.String getSystemProperty​(java.lang.String name)
        Retrieves a system property within a privileged block. Use it only when the property is used from within Rhino code and is not passed out of it.
        Parameters:
        name - the name of the system property
        Returns:
        the value of the system property
      • getProtectionDomain

        public static java.security.ProtectionDomain getProtectionDomain​(java.lang.Class<?> clazz)
      • getScriptProtectionDomain

        public static java.security.ProtectionDomain getScriptProtectionDomain()
        Look up the top-most element in the current stack representing a script and return its protection domain. This relies on the system-wide SecurityManager being an instance of RhinoSecurityManager, otherwise it returns null.
        Returns:
        The protection of the top-most script in the current stack, or null