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 <T> T |
doPrivileged(PrivilegedAction<T> action) |
static <T> T |
doPrivileged(PrivilegedExceptionAction<T> action) |
static Subject |
getSubject()
If using
Security.doAs(Subject, PrivilegedAction) or
Security.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 which is not of type
Group |
static boolean |
isPrivileged() |
public static <T> T doPrivileged(PrivilegedAction<T> action)
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action)
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
.public static <T> T doAs(Subject subject, PrivilegedExceptionAction<T> action)
Subject.doAs(Subject, PrivilegedExceptionAction)
which uses a ThreadLocal
Subject
instead of modifying the current AccessControlContext
.public static void checkPermission(CachePermission permission)
public static boolean isPrivileged()
public static Subject getSubject()
Security.doAs(Subject, PrivilegedAction)
or
Security.doAs(Subject, PrivilegedExceptionAction)
, returns the Subject
associated with the current thread
otherwise it returns the Subject
associated with the current AccessControlContext
Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.