class 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;
    }

}