Class Security

java.lang.Object
org.infinispan.security.Security

public final class Security extends Object
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 Details

    • Security

      public Security()
  • Method Details

    • doPrivileged

      public static <T> T doPrivileged(Supplier<T> action)
    • doPrivileged

      public static void doPrivileged(Runnable action)
    • doAs

      public static void doAs(Subject subject, Runnable action)
    • doAs

      public static <T> T doAs(Subject subject, Supplier<T> action)
    • doAs

      public static <T, R> R doAs(Subject subject, Function<T,R> function, T t)
    • doAs

      public static <T, U, R> R doAs(Subject subject, BiFunction<T,U,R> function, T t, U u)
    • isPrivileged

      public static boolean isPrivileged()
    • getSubject

      public static Subject getSubject()
      If using doAs(Subject, Runnable) or doAs(Subject, Function, Object) or doAs(Subject, BiFunction, Object, Object), returns the Subject associated with the current thread otherwise it returns null.
    • getSubjectUserPrincipal

      public static Principal getSubjectUserPrincipal(Subject s)
      Returns the first principal of a subject
    • getSubjectUserPrincipalName

      public static String getSubjectUserPrincipalName(Subject s)
    • toString

      public static String toString(Subject subject)
      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: