Class Utils


  • public final class Utils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean canImpersonateAllUsers​(@NotNull java.security.Principal principal, @NotNull UserManager userManager)
      Return true if the given principal can impersonate all users.
      static boolean isAdmin​(@NotNull java.security.Principal principal, @NotNull UserManager userManager)
      Return true if the given principal is admin.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • canImpersonateAllUsers

        public static boolean canImpersonateAllUsers​(@NotNull
                                                     @NotNull java.security.Principal principal,
                                                     @NotNull
                                                     @NotNull UserManager userManager)
        Return true if the given principal can impersonate all users. The implementation tests if the given principal refers to an existing User for which User.isAdmin() returns true OR if the user's principal name or any of its membership is configured to impersonate all users.
        Parameters:
        principal - A non-null principal instance.
        userManager - The user manager used for the lookup calling {@link UserManager#getAuthorizable(Principal))}
        Returns:
        true if the given principal can impersonate all users; false if that condition is not met or if the evaluation failed.
      • isAdmin

        public static boolean isAdmin​(@NotNull
                                      @NotNull java.security.Principal principal,
                                      @NotNull
                                      @NotNull UserManager userManager)
        Return true if the given principal is admin. The implementation tests if the given principal refers to an existing User for which User.isAdmin() returns true.
        Parameters:
        principal - A non-null principal instance.
        userManager - The user manager used for the lookup calling {@link UserManager#getAuthorizable(Principal))}
        Returns:
        true if the given principal is admin; false if that condition is not met or if the evaluation failed.