class BaseJavaDelegate implements JavaDelegate {

    protected void setSecurityContext(ApplicationUser applicationUser)
    {
        userNamespaceAuthorizationHelper.buildNamespaceAuthorizations(applicationUser);
        SecurityContextHolder.getContext().setAuthentication(new PreAuthenticatedAuthenticationToken(
            new SecurityUserWrapper(applicationUser.getUserId(), "", true, true, true, true, Collections.emptyList(), applicationUser), null));
    }

}