@MetaInfServices(value=java.lang.SecurityManager.class) public final class WildFlySecurityManager extends SecurityManager implements PermissionVerifier
inCheck
ALL, NONE
Constructor and Description |
---|
WildFlySecurityManager()
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
checkAccept(String host,
int port) |
void |
checkAccess(Thread t) |
void |
checkAccess(ThreadGroup g) |
void |
checkConnect(String host,
int port) |
void |
checkConnect(String host,
int port,
Object context) |
void |
checkCreateClassLoader() |
void |
checkDelete(String file) |
void |
checkExec(String cmd) |
void |
checkExit(int status) |
void |
checkLink(String lib) |
void |
checkListen(int port) |
void |
checkMemberAccess(Class<?> clazz,
int which)
Deprecated.
|
void |
checkMulticast(InetAddress maddr) |
void |
checkMulticast(InetAddress maddr,
byte ttl)
Deprecated.
|
void |
checkPackageAccess(String pkg) |
void |
checkPackageDefinition(String pkg) |
void |
checkPermission(Permission perm)
Perform a permission check.
|
void |
checkPermission(Permission perm,
AccessControlContext context)
Perform a permission check.
|
void |
checkPermission(Permission perm,
Object context)
Perform a permission check.
|
void |
checkPrintJobAccess() |
void |
checkPropertiesAccess() |
void |
checkPropertyAccess(String key) |
void |
checkRead(FileDescriptor fd) |
void |
checkRead(String file) |
void |
checkRead(String file,
Object context) |
void |
checkSecurityAccess(String target) |
void |
checkSetFactory() |
void |
checkWrite(FileDescriptor fd) |
void |
checkWrite(String file) |
static String |
clearPropertyPrivileged(String name)
Clear a property, doing a faster permission check that skips having to execute a privileged action frame.
|
static <T,P> T |
doChecked(P parameter,
ParametricPrivilegedAction<T,P> action)
Perform an action with permission checking enabled.
|
static <T,P> T |
doChecked(P parameter,
ParametricPrivilegedAction<T,P> action,
AccessControlContext context)
Perform an action with permission checking enabled.
|
static <T,P> T |
doChecked(P parameter,
ParametricPrivilegedExceptionAction<T,P> action)
Perform an action with permission checking enabled.
|
static <T,P> T |
doChecked(P parameter,
ParametricPrivilegedExceptionAction<T,P> action,
AccessControlContext context)
Perform an action with permission checking enabled.
|
static <T> T |
doChecked(PrivilegedAction<T> action)
Perform an action with permission checking enabled.
|
static <T> T |
doChecked(PrivilegedAction<T> action,
AccessControlContext context)
Perform an action with permission checking enabled.
|
static <T> T |
doChecked(PrivilegedExceptionAction<T> action)
Perform an action with permission checking enabled.
|
static <T> T |
doChecked(PrivilegedExceptionAction<T> action,
AccessControlContext context)
Perform an action with permission checking enabled.
|
static <T,P> T |
doPrivilegedWithParameter(P parameter,
ParametricPrivilegedAction<T,P> action)
Execute a parametric privileged action with the given parameter in a privileged context.
|
static <T,P> T |
doPrivilegedWithParameter(P parameter,
ParametricPrivilegedAction<T,P> action,
AccessControlContext accessControlContext)
Execute a parametric privileged action with the given parameter with the given context.
|
static <T,P> T |
doPrivilegedWithParameter(P parameter,
ParametricPrivilegedExceptionAction<T,P> action)
Execute a parametric privileged action with the given parameter in a privileged context.
|
static <T,P> T |
doPrivilegedWithParameter(P parameter,
ParametricPrivilegedExceptionAction<T,P> action,
AccessControlContext accessControlContext)
Execute a parametric privileged action with the given parameter with the given context.
|
static <T,P> T |
doUnchecked(P parameter,
ParametricPrivilegedAction<T,P> action)
Perform an action with permission checking disabled.
|
static <T,P> T |
doUnchecked(P parameter,
ParametricPrivilegedAction<T,P> action,
AccessControlContext context)
Perform an action with permission checking disabled.
|
static <T,P> T |
doUnchecked(P parameter,
ParametricPrivilegedExceptionAction<T,P> action)
Perform an action with permission checking disabled.
|
static <T,P> T |
doUnchecked(P parameter,
ParametricPrivilegedExceptionAction<T,P> action,
AccessControlContext context)
Perform an action with permission checking disabled.
|
static <T> T |
doUnchecked(PrivilegedAction<T> action)
Perform an action with permission checking disabled.
|
static <T> T |
doUnchecked(PrivilegedAction<T> action,
AccessControlContext context)
Perform an action with permission checking disabled.
|
static <T> T |
doUnchecked(PrivilegedExceptionAction<T> action)
Perform an action with permission checking disabled.
|
static <T> T |
doUnchecked(PrivilegedExceptionAction<T> action,
AccessControlContext context)
Perform an action with permission checking disabled.
|
static ProtectionDomain |
findAccessDenial(Permission permission,
ProtectionDomain... domains)
Find the protection domain in the given list which denies a permission, or
null if the permission
check would pass. |
static ClassLoader |
getClassLoaderPrivileged(Class<?> clazz)
Get the class loader for a class, doing a faster permission check that skips having to execute a privileged action
frame.
|
static ClassLoader |
getCurrentContextClassLoaderPrivileged()
Get the current thread's context class loader, doing a faster permission check that skips having to execute a
privileged action frame.
|
static String |
getEnvPropertyPrivileged(String name,
String def)
Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame.
|
static String |
getPropertyPrivileged(String name,
String def)
Get a property, doing a faster permission check that skips having to execute a privileged action frame.
|
static Map<String,String> |
getSystemEnvironmentPrivileged()
Get the system environment map, doing a faster permission check that skips having to execute a privileged action
frame.
|
static Properties |
getSystemPropertiesPrivileged()
Get the system properties map, doing a faster permission check that skips having to execute a privileged action
frame.
|
boolean |
implies(Permission permission)
Determine if the permission is verified by this object.
|
static void |
install()
Deprecated.
|
static boolean |
isChecking()
Determine whether the security manager is currently checking permissions.
|
static ClassLoader |
setCurrentContextClassLoaderPrivileged(Class<?> clazz)
Set the current thread's context class loader, doing a faster permission check that skips having to execute a
privileged action frame.
|
static ClassLoader |
setCurrentContextClassLoaderPrivileged(ClassLoader newClassLoader)
Set the current thread's context class loader, doing a faster permission check that skips having to execute a
privileged action frame.
|
static String |
setPropertyPrivileged(String name,
String value)
Set a property, doing a faster permission check that skips having to execute a privileged action frame.
|
static boolean |
tryCheckPermission(Permission permission,
ProtectionDomain... domains)
Try a permission check.
|
checkAwtEventQueueAccess, checkSystemClipboardAccess, checkTopLevelWindow, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, getSecurityContext, getThreadGroup, inClass, inClassLoader
public WildFlySecurityManager() throws SecurityException
SecurityException
- if the caller does not have permission to create a security manager instance@Deprecated public static void install() throws SecurityException
SecurityException
public static boolean isChecking()
true
if the security manager is currently checking permissionspublic void checkPermission(Permission perm) throws SecurityException
checkPermission
in interface PermissionVerifier
checkPermission
in class SecurityManager
perm
- the permission to checkSecurityException
- if the check failspublic void checkPermission(Permission perm, Object context) throws SecurityException
checkPermission
in class SecurityManager
perm
- the permission to checkcontext
- the security context to use for the check (must be an AccessControlContext
instance)SecurityException
- if the check failspublic static ProtectionDomain findAccessDenial(Permission permission, ProtectionDomain... domains)
null
if the permission
check would pass.permission
- the permission to testdomains
- the protection domains to trynull
if there is nonepublic static boolean tryCheckPermission(Permission permission, ProtectionDomain... domains)
org.wildfly.security.access
category
at a DEBUG
level.permission
- the permission to checkdomains
- the protection domains to trytrue
if the access check succeeded, false
otherwisepublic boolean implies(Permission permission)
PermissionVerifier
implies
in interface PermissionVerifier
permission
- the permission to verify (must not be null
)true
if the permission is implied by this verifier, false
otherwisepublic void checkPermission(Permission perm, AccessControlContext context) throws SecurityException
perm
- the permission to checkcontext
- the security context to use for the checkSecurityException
- if the check failspublic void checkCreateClassLoader()
checkCreateClassLoader
in class SecurityManager
public void checkAccess(Thread t)
checkAccess
in class SecurityManager
public void checkAccess(ThreadGroup g)
checkAccess
in class SecurityManager
public void checkExit(int status)
checkExit
in class SecurityManager
public void checkExec(String cmd)
checkExec
in class SecurityManager
public void checkLink(String lib)
checkLink
in class SecurityManager
public void checkRead(FileDescriptor fd)
checkRead
in class SecurityManager
public void checkRead(String file)
checkRead
in class SecurityManager
public void checkRead(String file, Object context)
checkRead
in class SecurityManager
public void checkWrite(FileDescriptor fd)
checkWrite
in class SecurityManager
public void checkWrite(String file)
checkWrite
in class SecurityManager
public void checkDelete(String file)
checkDelete
in class SecurityManager
public void checkConnect(String host, int port)
checkConnect
in class SecurityManager
public void checkConnect(String host, int port, Object context)
checkConnect
in class SecurityManager
public void checkListen(int port)
checkListen
in class SecurityManager
public void checkAccept(String host, int port)
checkAccept
in class SecurityManager
public void checkMulticast(InetAddress maddr)
checkMulticast
in class SecurityManager
@Deprecated public void checkMulticast(InetAddress maddr, byte ttl)
checkMulticast
in class SecurityManager
public void checkPropertiesAccess()
checkPropertiesAccess
in class SecurityManager
public void checkPropertyAccess(String key)
checkPropertyAccess
in class SecurityManager
public void checkPrintJobAccess()
checkPrintJobAccess
in class SecurityManager
public void checkPackageAccess(String pkg)
checkPackageAccess
in class SecurityManager
public void checkPackageDefinition(String pkg)
checkPackageDefinition
in class SecurityManager
public void checkSetFactory()
checkSetFactory
in class SecurityManager
@Deprecated public void checkMemberAccess(Class<?> clazz, int which)
checkMemberAccess
in class SecurityManager
public void checkSecurityAccess(String target)
checkSecurityAccess
in class SecurityManager
public static <T> T doChecked(PrivilegedAction<T> action)
T
- the action return typeaction
- the action to performpublic static <T> T doChecked(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
T
- the action return typeaction
- the action to performPrivilegedActionException
- if the action threw an exceptionpublic static <T> T doChecked(PrivilegedAction<T> action, AccessControlContext context)
T
- the action return typeaction
- the action to performcontext
- the access control context to usepublic static <T> T doChecked(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException
T
- the action return typeaction
- the action to performcontext
- the access control context to usePrivilegedActionException
- if the action threw an exceptionpublic static <T,P> T doChecked(P parameter, ParametricPrivilegedAction<T,P> action)
T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performpublic static <T,P> T doChecked(P parameter, ParametricPrivilegedExceptionAction<T,P> action) throws PrivilegedActionException
T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performPrivilegedActionException
- if the action threw an exceptionpublic static <T,P> T doChecked(P parameter, ParametricPrivilegedAction<T,P> action, AccessControlContext context)
T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performcontext
- the access control context to usepublic static <T,P> T doChecked(P parameter, ParametricPrivilegedExceptionAction<T,P> action, AccessControlContext context) throws PrivilegedActionException
T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performcontext
- the access control context to usePrivilegedActionException
- if the action threw an exceptionpublic static <T> T doUnchecked(PrivilegedAction<T> action)
doUnchecked
runtime permission.T
- the action return typeaction
- the action to performpublic static <T> T doUnchecked(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
doUnchecked
runtime permission.T
- the action return typeaction
- the action to performPrivilegedActionException
- if the action threw an exceptionpublic static <T> T doUnchecked(PrivilegedAction<T> action, AccessControlContext context)
doUnchecked
runtime permission.T
- the action return typeaction
- the action to performcontext
- the access control context to usepublic static <T> T doUnchecked(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException
doUnchecked
runtime permission.T
- the action return typeaction
- the action to performcontext
- the access control context to usePrivilegedActionException
- if the action threw an exceptionpublic static <T,P> T doUnchecked(P parameter, ParametricPrivilegedAction<T,P> action)
doUnchecked
runtime permission.T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performpublic static <T,P> T doUnchecked(P parameter, ParametricPrivilegedExceptionAction<T,P> action) throws PrivilegedActionException
doUnchecked
runtime permission.T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performPrivilegedActionException
- if the action threw an exceptionpublic static <T,P> T doUnchecked(P parameter, ParametricPrivilegedAction<T,P> action, AccessControlContext context)
doUnchecked
runtime permission.T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performcontext
- the access control context to usepublic static <T,P> T doUnchecked(P parameter, ParametricPrivilegedExceptionAction<T,P> action, AccessControlContext context) throws PrivilegedActionException
doUnchecked
runtime permission.T
- the action return typeP
- the action parameter typeparameter
- the parameter to pass to the actionaction
- the action to performcontext
- the access control context to usePrivilegedActionException
- if the action threw an exceptionpublic static String getPropertyPrivileged(String name, String def)
name
- the property namedef
- the default value if the property is not foundpublic static String getEnvPropertyPrivileged(String name, String def)
name
- the property namedef
- the default value if the property is not foundpublic static String setPropertyPrivileged(String name, String value)
name
- the property namevalue
- the value ot setnull
if there was nonepublic static String clearPropertyPrivileged(String name)
name
- the property namenull
if there was nonepublic static ClassLoader getCurrentContextClassLoaderPrivileged()
public static ClassLoader setCurrentContextClassLoaderPrivileged(ClassLoader newClassLoader)
newClassLoader
- the new class loader to setpublic static ClassLoader setCurrentContextClassLoaderPrivileged(Class<?> clazz)
clazz
- the class whose class loader is the new class loader to setpublic static Properties getSystemPropertiesPrivileged()
public static Map<String,String> getSystemEnvironmentPrivileged()
public static ClassLoader getClassLoaderPrivileged(Class<?> clazz)
clazz
- the class to checkpublic static <T,P> T doPrivilegedWithParameter(P parameter, ParametricPrivilegedAction<T,P> action)
T
- the action result typeP
- the parameter typeparameter
- the parameter to send in to the actionaction
- the action to executepublic static <T,P> T doPrivilegedWithParameter(P parameter, ParametricPrivilegedExceptionAction<T,P> action) throws PrivilegedActionException
T
- the action result typeP
- the parameter typeparameter
- the parameter to send in to the actionaction
- the action to executePrivilegedActionException
public static <T,P> T doPrivilegedWithParameter(P parameter, ParametricPrivilegedAction<T,P> action, AccessControlContext accessControlContext)
T
- the action result typeP
- the parameter typeparameter
- the parameter to send in to the actionaction
- the action to executeaccessControlContext
- the context to usepublic static <T,P> T doPrivilegedWithParameter(P parameter, ParametricPrivilegedExceptionAction<T,P> action, AccessControlContext accessControlContext) throws PrivilegedActionException
T
- the action result typeP
- the parameter typeparameter
- the parameter to send in to the actionaction
- the action to executeaccessControlContext
- the context to usePrivilegedActionException
Copyright © 2020 JBoss by Red Hat. All rights reserved.