Class TestSecurityUtils


  • public class TestSecurityUtils
    extends Object
    A utility class that can be used when writing tests. Do not use this for other purposes than tests, as it will set a non-persisted user as the threadlocal for the Spring Security context.
    Author:
    Joram Barrez
    • Method Detail

      • setTestAuthenticatedUser

        public static void setTestAuthenticatedUser​(String userId,
                                                    String tenantId)
      • setTestAuthenticatedUser

        public static void setTestAuthenticatedUser​(String userId,
                                                    String tenantId,
                                                    String... groupKeys)
      • setTestAuthenticatedUser

        public static void setTestAuthenticatedUser​(String userId)
      • resetTestAuthenticatedUser

        public static void resetTestAuthenticatedUser()