Package org.eclipse.jetty.util.security
Class SecurityUtils
java.lang.Object
org.eclipse.jetty.util.security.SecurityUtils
Collections of utility methods to deal with the scheduled removal of the security classes defined by JEP 411.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkPermission
(Permission permission) Checks the given permission, if thesecurity manager
is set.static <T> T
Runs the given action as the given subject.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.static Object
Get the current security manager, if available.
-
Method Details
-
getSecurityManager
Get the current security manager, if available.- Returns:
- the current security manager, if available
-
checkPermission
Checks the given permission, if the
security manager
is set.- Parameters:
permission
- the permission to check- Throws:
SecurityException
- if the permission check fails
-
doPrivileged
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
Runs the given action as the given subject.
- Type Parameters:
T
- the type of the result- Parameters:
subject
- the subject this action runs asaction
- the action to run- Returns:
- the result of the action
-