Class SecurityUtil


  • public final class SecurityUtil
    extends java.lang.Object
    A Security util.
    • Field Detail

      • module

        public static final java.lang.String module
    • Constructor Detail

      • SecurityUtil

        public SecurityUtil()
    • Method Detail

      • hasUserLoginAdminPermission

        public static boolean hasUserLoginAdminPermission​(Delegator delegator,
                                                          java.lang.String userLoginId)
        Return true if given userLogin possess at least one of the adminPermission
        Parameters:
        delegator -
        userLoginId -
        Returns:
        boolean
      • hasUserLoginMorePermissionThan

        public static java.util.List<java.lang.String> hasUserLoginMorePermissionThan​(Delegator delegator,
                                                                                      java.lang.String userLoginId,
                                                                                      java.lang.String toUserLoginId)
        Return the list of missing permission, if toUserLoginId has more permission thant userLoginId, emptyList either.
        Parameters:
        delegator -
        userLoginId -
        toUserLoginId -
        Returns:
        List
      • generateJwtToAuthenticateUserLogin

        public static java.lang.String generateJwtToAuthenticateUserLogin​(Delegator delegator,
                                                                          java.lang.String userLoginId)
                                                                   throws GenericEntityException
        Return a JWToken for authenticate a userLogin with salt the token by userLoginId and currentPassword
        Throws:
        GenericEntityException
      • authenticateUserLoginByJWT

        public static boolean authenticateUserLoginByJWT​(Delegator delegator,
                                                         java.lang.String userLoginId,
                                                         java.lang.String jwtToken)
        For a jwtToken and userLoginId check the coherence between them
      • containsFreemarkerInterpolation

        public static boolean containsFreemarkerInterpolation​(HttpServletRequest req,
                                                              HttpServletResponse resp,
                                                              java.lang.String uri)
                                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • containsFreemarkerInterpolation

        public static boolean containsFreemarkerInterpolation​(HttpServletResponse resp,
                                                              java.lang.String stringToCheck)
                                                       throws java.io.IOException
        Parameters:
        resp -
        stringToCheck -
        Throws:
        java.io.IOException