Package org.infinispan.security
Class Security
java.lang.Object
org.infinispan.security.Security
Security. A simple class to implement caller privileges without a security manager.
N.B. this uses the caller's Package
, this can easily be subverted by placing the calling code within the
org.infinispan hierarchy. For most purposes, however, this is ok.
- Since:
- 7.0
- Author:
- Tristan Tarrant
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
static <T,
U, R> R doAs
(Subject subject, BiFunction<T, U, R> function, T t, U u) static <T,
R> R static <T> T
static void
doPrivileged
(Runnable action) static <T> T
doPrivileged
(Supplier<T> action) static Subject
If usingdoAs(Subject, Runnable)
ordoAs(Subject, Function, Object)
ordoAs(Subject, BiFunction, Object, Object)
, returns theSubject
associated with the current thread otherwise it returns null.static Principal
Returns the first principal of a subjectstatic String
static boolean
static String
A simplified version of Subject.toString() with the following advantages: only lists principals, ignoring credentials uses a compact, single-line format does not use synchronization does not use i18n messages
-
Constructor Details
-
Security
public Security()
-
-
Method Details
-
doPrivileged
-
doPrivileged
-
doAs
-
doAs
-
doAs
-
doAs
-
isPrivileged
public static boolean isPrivileged() -
getSubject
If usingdoAs(Subject, Runnable)
ordoAs(Subject, Function, Object)
ordoAs(Subject, BiFunction, Object, Object)
, returns theSubject
associated with the current thread otherwise it returns null. -
getSubjectUserPrincipal
Returns the first principal of a subject -
getSubjectUserPrincipalName
-
toString
A simplified version of Subject.toString() with the following advantages:- only lists principals, ignoring credentials
- uses a compact, single-line format
- does not use synchronization
- does not use i18n messages
- Parameters:
subject
-- Returns:
-