Unreal Engine doesn't have any built-in features for create highly-customized lens flares. By default, lens flares are implemented as a image-based effect, so we deal with engine rendering system. In our game we need custom lens flares that can be blocked by other objects. For example, if we have a light source that shine in camera on a background plane and some object, that blocking this light, lens flare should be blocked. This is the main problem.
In this tutorial, I described a solution of this problem. Note, that the material, described below works correctly only for cameras without fixed aspect ratio (fixed aspect crops image and mask cropped areas with blackbars) and with fov equals 90. You can get the complex solution, that works correctly for all cases from unreal marketplace: https://www.unrealengine.com/marketplace/custom-lens-flares-material