Package com.jogamp.common.util
Class SecurityUtil
- java.lang.Object
-
- com.jogamp.common.util.SecurityUtil
-
public class SecurityUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description SecurityUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckAllLinkPermission()Throws anSecurityExceptionif an installedSecurityManagerdoes not permit to dynamically link to all libraries.static voidcheckAllPermissions()Throws anSecurityExceptionif an installedSecurityManagerdoes not permit the requestedAllPermission.static voidcheckLinkPermission(String libName)Throws anSecurityExceptionif an installedSecurityManagerdoes not permit to dynamically link the given libName.static voidcheckPermission(Permission perm)Throws anSecurityExceptionif an installedSecurityManagerdoes not permit the requestedPermission.static <T> TdoPrivileged(PrivilegedAction<T> o)Call wrapper forAccessController.doPrivileged(PrivilegedAction).static booleanequals(Certificate[] a, Certificate[] b)static Certificate[]getCerts(Class<?> clz)static SecurityManagergetSecurityManager()Call wrapper forSystem.getSecurityManager().static booleanhasAllPermissions()Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckPermission(new AllPermission())passes.static booleanhasLinkPermission(String libName)Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckLink(libName)passes.static booleanhasPermission(Permission perm)Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckPermission(perm)passes.
-
-
-
Method Detail
-
getSecurityManager
public static final SecurityManager getSecurityManager()
Call wrapper forSystem.getSecurityManager().System.getSecurityManager()is deprecated since Java 17 (JEP 411) and earmarked to be removed.
On a Java 17 machine, this method will simply return null.
-
doPrivileged
public static <T> T doPrivileged(PrivilegedAction<T> o)
Call wrapper forAccessController.doPrivileged(PrivilegedAction).AccessController.doPrivileged(PrivilegedAction)is deprecated since Java 17 (JEP 411) and earmarked to be removed.
On a Java 17 machine, this method will simply invoke the given PrivilegedAction
. - Type Parameters:
T- return type of PrivilegedAction- Parameters:
o- the PrivilegedAction- Returns:
- the return type
-
hasAllPermissions
public static final boolean hasAllPermissions()
Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckPermission(new AllPermission())passes. Otherwise method returnsfalse.
-
hasPermission
public static final boolean hasPermission(Permission perm)
Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckPermission(perm)passes. Otherwise method returnsfalse.
-
checkAllPermissions
public static final void checkAllPermissions() throws SecurityExceptionThrows anSecurityExceptionif an installedSecurityManagerdoes not permit the requestedAllPermission.- Throws:
SecurityException
-
checkPermission
public static final void checkPermission(Permission perm) throws SecurityException
Throws anSecurityExceptionif an installedSecurityManagerdoes not permit the requestedPermission.- Throws:
SecurityException
-
hasLinkPermission
public static final boolean hasLinkPermission(String libName)
Returnstrueif noSecurityManagerhas been installed or the installedSecurityManager'scheckLink(libName)passes. Otherwise method returnsfalse.
-
checkLinkPermission
public static final void checkLinkPermission(String libName) throws SecurityException
Throws anSecurityExceptionif an installedSecurityManagerdoes not permit to dynamically link the given libName.- Throws:
SecurityException
-
checkAllLinkPermission
public static final void checkAllLinkPermission() throws SecurityExceptionThrows anSecurityExceptionif an installedSecurityManagerdoes not permit to dynamically link to all libraries.- Throws:
SecurityException
-
getCerts
public static final Certificate[] getCerts(Class<?> clz) throws SecurityException
- Parameters:
clz-- Returns:
- Throws:
SecurityException- if the caller has no permission to access the ProtectedDomain of the given class.
-
equals
public static final boolean equals(Certificate[] a, Certificate[] b)
-
-