SecurityHelper { public boolean isUserGeneratedByClass(Authentication authentication, Class<?> generatedByClass) { boolean isGeneratedBy = false; if (authentication != null) { SecurityUserWrapper securityUserWrapper = (SecurityUserWrapper) authentication.getPrincipal(); if (securityUserWrapper != null && securityUserWrapper.getApplicationUser().getGeneratedByClass().equals(generatedByClass)) { isGeneratedBy = true; } } return isGeneratedBy; }  Set<GrantedAuthority> getUnrestrictedFunctions(); boolean isSecurityEnabled(HttpServletRequest request); boolean isUserGeneratedByClass(Authentication authentication, Class<?> generatedByClass); Set<GrantedAuthority> mapRolesToFunctions(Collection<String> roles);  }
@Test public void testIsGeneratedBy() throws Exception { assertFalse(securityHelper.isUserGeneratedByClass(null, null)); PreAuthenticatedAuthenticationToken authRequest = new PreAuthenticatedAuthenticationToken(null, null); assertFalse(securityHelper.isUserGeneratedByClass(authRequest, null)); }