public final class Security extends Object
Subject.doAs(Subject, PrivilegedAction)
and Subject.doAs(Subject, PrivilegedExceptionAction)
when interaction with the AccessControlContext
is not needed.
N.B. this uses the caller's Package
, this can easily be subverted by placing the calling code within the
org.infinispan hierarchy. However for most purposes this is ok.
Constructor and Description |
---|
Security() |
Modifier and Type | Method and Description |
---|---|
static void |
checkPermission(CachePermission permission) |
static <T> T |
doAs(Subject subject,
PrivilegedAction<T> action)
A "lightweight" implementation of
Subject.doAs(Subject, PrivilegedAction) which uses a ThreadLocal Subject instead of modifying the current AccessControlContext . |
static <T> T |
doAs(Subject subject,
PrivilegedExceptionAction<T> action)
A "lightweight" implementation of
Subject.doAs(Subject, PrivilegedExceptionAction) which uses a
ThreadLocal Subject instead of modifying the current AccessControlContext . |
static void |
doAs(Subject subject,
Runnable action) |
static <T> T |
doPrivileged(PrivilegedAction<T> action) |
static <T> T |
doPrivileged(PrivilegedExceptionAction<T> action) |
static Subject |
getSubject()
If using
doAs(Subject, PrivilegedAction) or doAs(Subject,
PrivilegedExceptionAction) , returns the Subject associated with the current thread otherwise it returns
the Subject associated with the current AccessControlContext |
static Principal |
getSubjectUserPrincipal(Subject s)
Returns the first principal of a subject
|
static boolean |
isPrivileged() |
public static <T> T doPrivileged(PrivilegedAction<T> action)
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
PrivilegedActionException
public static <T> T doAs(Subject subject, PrivilegedAction<T> action)
Subject.doAs(Subject, PrivilegedAction)
which uses a ThreadLocal Subject
instead of modifying the current AccessControlContext
.Subject.doAs(Subject, PrivilegedAction)
public static <T> T doAs(Subject subject, PrivilegedExceptionAction<T> action) throws PrivilegedActionException
Subject.doAs(Subject, PrivilegedExceptionAction)
which uses a
ThreadLocal Subject
instead of modifying the current AccessControlContext
.PrivilegedActionException
Subject.doAs(Subject, PrivilegedExceptionAction)
public static void checkPermission(CachePermission permission) throws AccessControlException
AccessControlException
public static boolean isPrivileged()
public static Subject getSubject()
doAs(Subject, PrivilegedAction)
or doAs(Subject,
PrivilegedExceptionAction)
, returns the Subject
associated with the current thread otherwise it returns
the Subject
associated with the current AccessControlContext
Copyright © 2021 JBoss by Red Hat. All rights reserved.